Package PyML :: Package preproc :: Module preproc :: Class Standardizer
[frames] | no frames]

Class Standardizer

source code

base.pymlObject.PyMLobject --+
                             |
                            Standardizer

class for performing feature normalization

For each feature the Standardizer subtracts the feature's mean and divides by its standard deviation

this rescaling is composed of two operations:

  1. ``centering`` -- subtract from a feature its mean value; this is referred to as 'translation'; the translation attribute gives the value with which to translate each feature
  2. ``scaling`` -- divide a feature by a scale, e.g. its standard deviation; the 'scale' attribute gives the value with which to scale each feature

the 'train' method of the class computes the translation and scaling factors, and performs normalization of the training data the 'test' method uses values computed on the training data to normalize the test data.

**caveat:** Beware of performing training multiple times on the same dataset: if a dataset has already been standardized, re-standardization will recompute mean and standard deviation, which will be approximately 0 and 1 for each feature; subsequent application on test data will have no effect. Because of this an exception is raised if the user attempts to re-train an already trained Rescale object.

Instance Methods
 
__init__(self, **args) source code
 
train(self, data, *options, **args) source code
 
preproc(self, data) source code
 
test(self, data, *options, **args) source code
Class Variables
  attributes = {'translate': True, 'rescale': True, 'translation...
Class Variable Details

attributes

Value:
{'translate': True, 'rescale': True, 'translation': None, 'scale': Non\
e}