from da import DenoisingAutoencoder
from dataset import Dataset
import theano.tensor as T
import numpy

if __name__ == "__main__":
    fname = "/data/lisa/data/mnist/mnist_all.pickle"
    # fname = "/data/lisa/data/pentomino/"
    ds = Dataset()
    ds.setup_dataset(data_path=fname, train_split_scale=0.8)
    x_data = ds.Xtrain
    input = T.dmatrix("x_input")

    weights_file = "../out/dae_mnist_weights.npy"
    recons_file = "../out/dae_mnist_recons.npy"
    rnd = numpy.random.RandomState(1231)
    dae = DenoisingAutoencoder(input, nvis=28 * 28, nhid=600, rnd=rnd)
    dae.fit(learning_rate=0.1, data=x_data, weights_file=weights_file, n_epochs=100, recons_img_file=recons_file)
Beispiel #2
0
    nhid_l2 = 800

    dae_l1 = DenoisingAutoencoder(input,
            nvis=28*28,
            nhid=nhid_l1,
            L1_reg=9*1e-5,
            L2_reg=7*1e-4,
            rnd=rnd)

    #std_data = standardize(x_data)
    std_data = numpy.asarray(x_data, dtype=theano.config.floatX)

    dae_l1.fit(learning_rate=9.96*1e-3,
            shuffle_data=True,
            data=std_data,
            weights_file=weights_file_l1,
            recons_img_file=None,
            corruption_level=0.095,
            batch_size=40,
            n_epochs=1400)

    dae_l1_obj_out = open("dae_l1_obj.pkl", "wb")
    pkl.dump(dae_l1, dae_l1_obj_out,  protocol=pkl.HIGHEST_PROTOCOL)


    dae_l1_out = dae_l1.encode(input)
    dae_l1_h = dae_l1.encode(std_data)
    dae_l1_h_fn = theano.function([], dae_l1_h)
    dae_l2_in = dae_l1_h_fn()
    dae_l2_in = numpy.asarray(dae_l2_in, dtype=theano.config.floatX)

    dae_l2 = DenoisingAutoencoder(dae_l1_out,
Beispiel #3
0
from da import DenoisingAutoencoder
from dataset import Dataset
import theano.tensor as T
import numpy

if __name__ == "__main__":
    fname = "/data/lisa/data/pentomino/pento64x64_40k_seed_5365102867_64patches.npy"
    ds = Dataset()
    ds.setup_dataset(data_path=fname, train_split_scale=0.4)
    x_data = ds.Xtrain
    input = T.dmatrix("x_input")
    rnd = numpy.random.RandomState(1231)
    dae = DenoisingAutoencoder(input, nvis=64 * 64, nhid=1500, rnd=rnd)

    dae.fit(data=x_data,
            learning_rate=0.04,
            n_epochs=32,
            weights_file="out/dae_weights_pento.npy")
Beispiel #4
0
from da import DenoisingAutoencoder
from dataset import Dataset
import theano.tensor as T
import numpy

if __name__ == "__main__":
    fname = "/data/lisa/data/mnist/mnist_all.pickle"
    #fname = "/data/lisa/data/pentomino/"
    ds = Dataset()
    ds.setup_dataset(data_path=fname, train_split_scale=0.8)
    x_data = ds.Xtrain
    input = T.dmatrix("x_input")

    weights_file = "../out/dae_mnist_weights.npy"
    recons_file = "../out/dae_mnist_recons.npy"
    rnd = numpy.random.RandomState(1231)
    dae = DenoisingAutoencoder(input, nvis=28 * 28, nhid=600, rnd=rnd)
    dae.fit(learning_rate=0.1,
            data=x_data,
            weights_file=weights_file,
            n_epochs=100,
            recons_img_file=recons_file)
from da import DenoisingAutoencoder
from dataset import Dataset
import theano.tensor as T
import numpy

if __name__=="__main__":
    fname = "/data/lisa/data/pentomino/pento64x64_40k_seed_5365102867_64patches.npy"
    ds = Dataset()
    ds.setup_dataset(data_path=fname, train_split_scale=0.4)
    x_data = ds.Xtrain
    input = T.dmatrix("x_input")
    rnd = numpy.random.RandomState(1231)
    dae = DenoisingAutoencoder(input,
            nvis=64*64,
            nhid=1500,
            rnd=rnd)

    dae.fit(data=x_data,
            learning_rate=0.04,
            n_epochs=32,
            weights_file="out/dae_weights_pento.npy")