# HG changeset patch # User Pierre-Antoine Manzagol # Date 1265764486 18000 # Node ID 4e3a3d9fef4306bb9ce005551f369955d781cdbf # Parent 257a39cce72c758d4b8a680072d43d98e9ea20e7 Dataset: added preprocess attribute. diff -r 257a39cce72c -r 4e3a3d9fef43 pylearn/datasets/dataset.py --- a/pylearn/datasets/dataset.py Fri Feb 05 11:53:48 2010 -0500 +++ b/pylearn/datasets/dataset.py Tue Feb 09 20:14:46 2010 -0500 @@ -108,6 +108,13 @@ img_shape = None # (rows, cols) + """ + When inputs 'x' must somehow be preprocessed, processor is a function that + will take care of it. + A cleaner (transparent) alternative would be for x to wrap the data intelligently. + """ + preprocess = None + """ TIMESERIES diff -r 257a39cce72c -r 4e3a3d9fef43 pylearn/datasets/nist_sd.py --- a/pylearn/datasets/nist_sd.py Fri Feb 05 11:53:48 2010 -0500 +++ b/pylearn/datasets/nist_sd.py Tue Feb 09 20:14:46 2010 -0500 @@ -7,6 +7,8 @@ from pylearn.datasets.config import data_root # config from pylearn.datasets.dataset import Dataset +def nist_to_float(x): + return x / 255.0 def load(dataset = 'train', attribute = 'data'): """Load the filetensor corresponding to the set and attribute. @@ -35,6 +37,7 @@ # rval.n_classes = 10 rval.img_shape = (32,32) + rval.preprocess = nist_to_float # train examples = load(dataset = 'train', attribute = 'data')