This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 06 | |
16 06 | |
20 06 | |
01 07 | |
02 07 | |
03 07 | |
04 07 | |
05 07 | |
06 07 | |
07 07 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def image_grid(data, n_cols=None, zoom=1): | |
if n_cols is None: | |
n_cols = int(np.ceil(np.sqrt(data.shape[0]))) | |
n_rows = int(np.ceil(data.shape[0]/n_cols)) | |
target = np.zeros((data.shape[1]*n_rows, data.shape[2]*n_cols, data.shape[3]), dtype=data.dtype) | |
flat_data = data.swapaxes(1,2).reshape((data.shape[0]*data.shape[1], data.shape[2], data.shape[3])).swapaxes(0, 1) | |
for i in range(n_rows): | |
start_y = i*data.shape[2]*n_cols | |
end_y = (i+1)*data.shape[2]*n_cols | |
start_x = i*data.shape[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.decomposition import PCA, FactorAnalysis, SparsePCA | |
from sklearn import datasets | |
dset = datasets.load_digits() | |
x = dset.data | |
y = dset.target | |
model = PCA(n_components=2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theano | |
import theano.tensor as T | |
import numpy as np | |
import cPickle | |
import random | |
import matplotlib.pyplot as plt | |
class RNN(object): | |
def __init__(self, nin, n_hidden, nout): |