Mercurial > pylearn
changeset 896:4e3a3d9fef43
Dataset: added preprocess attribute.
author | Pierre-Antoine Manzagol <pierre.antoine.manzagol@gmail.com> |
---|---|
date | Tue, 09 Feb 2010 20:14:46 -0500 |
parents | 257a39cce72c |
children | 2f8614685be3 |
files | pylearn/datasets/dataset.py pylearn/datasets/nist_sd.py |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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')