Skip to content

Instantly share code, notes, and snippets.

View CarlosCancino-Chacon's full-sized avatar

Carlos Eduardo Cancino-Chacón CarlosCancino-Chacon

View GitHub Profile
@CarlosCancino-Chacon
CarlosCancino-Chacon / cg.py
Created October 16, 2015 15:31
Conjugate gradient optimization for Lasagne
from collections import OrderedDict
import numpy as np
import theano
import theano.tensor as T
from theano.ifelse import ifelse
def cg(loss, params, x0=None, max_iters=100, precondition=None, tol=1e-3,
conv_crit='cg'):
"""(Preconditioned) Conjugate Gradient (CG) updates
@CarlosCancino-Chacon
CarlosCancino-Chacon / autoencoder.py
Created November 20, 2015 23:53
Helper functions for building autoencoders
import lasagne
import theano
from lasagne import init
from lasagne import nonlinearities
from lasagne.layers import get_all_layers
from lasagne.layers import (
NonlinearityLayer, BiasLayer,
DropoutLayer, GaussianNoiseLayer,