Skip to content

Instantly share code, notes, and snippets.

View pbloem's full-sized avatar

Peter Bloem pbloem

View GitHub Profile
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from datetime import datetime
import numpy as np
from keras import Input
import keras.backend as K
from keras.callbacks import TensorBoard
from keras.engine import Model
from keras.layers import LSTM, TimeDistributed, Dense, Reshape, Flatten, LeakyReLU, Lambda
from keras.optimizers import Adam, sgd
@pbloem
pbloem / autoencoder.ipynb
Last active July 31, 2017 11:47
Autoencoder in ipython
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pbloem
pbloem / Classification plain.ipynb
Last active June 7, 2017 20:55
Simple classifier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pbloem
pbloem / grades.py
Last active February 3, 2017 23:25
import scipy.misc as sm
import math
import random
import itertools as it
import matplotlib
import matplotlib.pyplot as pp
def combine(all, result, d=1, totalpoints = 0, totallogprob = 0):
"""
Computes the complete probability distribution over the total points.
Compiled from "Sandbox.java"
public class Sandbox {
public static final java.util.Random RANDOM;
public static double sumWith;
public static double sumWithout;
public static double t0;
@pbloem
pbloem / Timing.java
Last active September 23, 2016 16:19
Example of strange Java behavior
import static java.lang.System.currentTimeMillis;
import java.util.Arrays;
import java.util.Random;
public class Sandbox
{
public static final Random RANDOM = new Random();
public static double sumWith = 0;
# -*- coding: utf-8 -*-
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as p
from matplotlib import colors
import numpy as n
import pylab
import scipy.stats as stats
from __builtin__ import file
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* Simple demonstration of the bare necessities required to crate an image file
* @author Peter
@pbloem
pbloem / Synth.java
Last active May 17, 2024 21:45
A simple java program, showing how to play a tune.
import java.util.Arrays;
import java.util.List;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Synthesizer;
import javax.sound.midi.MidiChannel;
/**
* A little example showing how to play a tune in Java.
*