# HG changeset patch # User Frederic Bastien # Date 1296663634 18000 # Node ID e7844692e6e2217ced7176cbdbe95fbcedd2210e # Parent cedb48a300fc5239fe1b1ea3c96eb497bedaa110 normalize the utlc ndarray dataset inplace to use less memory. diff -r cedb48a300fc -r e7844692e6e2 pylearn/datasets/utlc.py --- 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: