This file contains 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
# Authors: Olivier Grisel <olivier.grisel@ensta.org> | |
# James Bergstra <james.bergstra@umontreal.ca> | |
# Vlad Niculae <vlad@vene.ro> | |
# | |
# License: BSD 3 Clause | |
# Updated to sklearn 0.14 by Kyle Kastner <kastnerkyle@gmail.com> | |
import numpy as np | |
from sklearn.decomposition import PCA |
This file contains 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
#!/usr/bin/env python | |
from pylearn2.models import mlp | |
from pylearn2.costs.mlp.dropout import Dropout | |
from pylearn2.training_algorithms import sgd, learning_rule | |
from pylearn2.termination_criteria import MonitorBased | |
from pylearn2.datasets import DenseDesignMatrix | |
from pylearn2.datasets import mnist | |
from pylearn2.train import Train | |
from pylearn2.train_extensions import best_params, window_flip | |
from pylearn2.space import VectorSpace |
This file contains 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
# Authors: Olivier Grisel <olivier.grisel@ensta.org> | |
# James Bergstra <james.bergstra@umontreal.ca> | |
# Vlad Niculae <vlad@vene.ro> | |
# Kyle Kastner <kastnerkyle@gmail.com> | |
# Samantha Massengill <sgmassengill@gmail.com> | |
# | |
# License: BSD 3 clause | |
import numpy as np | |
from sklearn.decomposition import PCA |
This file contains 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
import numpy as np | |
from scipy import sparse | |
def minibatch_indices(X, minibatch_size): | |
minibatch_indices = np.arange(0, len(X), minibatch_size) | |
minibatch_indices = np.asarray(list(minibatch_indices) + [len(X)]) |
This file contains 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
#This code is for fun only! Use scipy.linalg.hadamard | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import functools | |
def memoize(obj): |
This file contains 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
from sklearn.base import BaseEstimator, TransformerMixin | |
from sklearn.utils import gen_batches | |
from scipy.linalg import eigh | |
from scipy.linalg import svd | |
import numpy as np | |
# From sklearn master |
This file contains 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
import numpy as np | |
class dhmm: | |
def __init__(self, n_states, initial_prob=None, | |
n_iter=100, random_seed=1999): | |
# Initial state probabilities p(s_0)=pi[s_0]. |
This file contains 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
import scipy.stats as st | |
import numpy as np | |
class gmmhmm: | |
#This class converted with modifications from https://code.google.com/p/hmm-speech-recognition/source/browse/Word.m | |
def __init__(self, n_states): | |
self.n_states = n_states |
This file contains 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
import numpy as np | |
from scipy import linalg | |
from sklearn.utils import array2d, as_float_array | |
from sklearn.utils.extmath import svd_flip | |
from sklearn.utils.testing import assert_array_almost_equal |
This file contains 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
import numpy as np | |
# Using data from http://www.mathsisfun.com/data/standard-deviation.html | |
X = np.array([600, 470, 170, 430, 300]) | |
# Showing steps from basic to Welford's and batch | |
# See http://cpsc.yale.edu/sites/default/files/files/tr222.pdf |
OlderNewer