Mercurial > pylearn
changeset 1410:e7844692e6e2
normalize the utlc ndarray dataset inplace to use less memory.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Wed, 02 Feb 2011 11:20:34 -0500 |
parents | cedb48a300fc |
children | 68fdb895f53f |
files | pylearn/datasets/utlc.py |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/datasets/utlc.py Mon Jan 31 12:23:20 2011 -0500 +++ b/pylearn/datasets/utlc.py Wed Feb 02 11:20:34 2011 -0500 @@ -43,27 +43,30 @@ test = numpy.asarray(test, theano.config.floatX) mean = train.mean() std = train.std() - train = (train - mean) / std - valid = (valid - mean) / std - test = (test - mean) / std + train -= mean + valid -= mean + test -= mean + train /= std + valid /= std + test /= std elif name == "harry": #force float32 as otherwise too big to keep in memory completly train = numpy.asarray(train, "float32") valid = numpy.asarray(valid, "float32") test = numpy.asarray(test, "float32") std = 0.69336046033925791#train.std()slow to compute - train = (train) / std - valid = (valid) / std - test = (test) / std + train /= std + valid /= std + test /= std elif name == "rita": #force float32 as otherwise too big to keep in memory completly train = numpy.asarray(train, "float32") valid = numpy.asarray(valid, "float32") test = numpy.asarray(test, "float32") max = train.max() - train = (train) / max - valid = (valid) / max - test = (test) / max + train /= max + valid /= max + test /= max else: raise Exception("This dataset don't have its normalization defined") if transfer: