import pydeep.base.numpyextension as numxext import pydeep.misc.io as io import pydeep.preprocessing as pre import pydeep.misc.visualization as vis # Model imports: RBM estimator, model and trainer module import pydeep.rbm.estimator as estimator import pydeep.rbm.model as model import pydeep.rbm.trainer as trainer # Set random seed (optional) # (optional, if stochastic processes are involved we get the same results) numx.random.seed(42) # Load data (download is not existing) data = io.load_natural_image_patches('NaturalImage.mat') # Remove the mean of ech image patch separately (also works without) data = pre.remove_rows_means(data) # Set input/output dimensions v1 = 14 v2 = 14 h1 = 14 h2 = 14 # Whiten data using ZCA zca = pre.ZCA(v1 * v2) zca.train(data) data = zca.project(data)
import numpy as numx import pydeep.misc.io as io import pydeep.misc.visualization as vis import pydeep.preprocessing as pre # Import cost functions, activation function, Autencoder and trainer module import pydeep.base.activationfunction as act import pydeep.base.costfunction as cost import pydeep.ae.model as aeModel import pydeep.ae.trainer as aeTrainer # Set random seed numx.random.seed(42) # Load data (download is not existing) data = io.load_natural_image_patches('../../../data/NaturalImage.mat') # Remove mean individually data = pre.remove_rows_means(data) # Shuffle data data = numx.random.permutation(data) # Specify input and hidden dimensions h1 = 20 h2 = 20 v1 = 14 v2 = 14 # Whiten data using ZCA or change it to STANDARIZER for unwhitened results zca = pre.ZCA(v1 * v2)