Implements data whitening (as result, each feature mean value is 0 with normalized stddev). More...
#include <data_scaler_white.hpp>
Public Member Functions | |
| Data_Scaler_white (const int dims=1) | |
no missing-value substitution; dims must be 1 | |
| Data_Scaler_white (const DATATYPE missing_val_code, const int dims) | |
values equal to missing_val_code are substituted (scaled value 0) rather than learned/scaled normally; dims must be 1 | |
| Data_Scaler_white (const Data_Scaler_white &ds) | |
| copies configuration and any already-learned statistics | |
| virtual int | learn_loops () const override |
| two passes: the variance of pass 2 needs the mean from pass 1 | |
| virtual bool | startFirstLoop () override |
| resets the mean accumulator and begins pass 1 | |
| virtual bool | startNextLoop () override |
| finalizes the mean (after pass 1) or the standard deviation (after pass 2); returns false once both passes are done | |
| virtual void | learn (const DATATYPE &value) override |
accumulates value into the mean (pass 1) or its squared deviation from that mean (pass 2), unless it is the missing-value code | |
| virtual DATATYPE | scale (const DATATYPE &value) override |
| returns (value-mean)/stddev; 0 for a missing value (which is the mean in whitened coordinates) and 0 for a feature with zero standard deviation | |
| virtual void | scale_inplace (DATATYPE &value) override |
| the in-place form of scale() | |
| virtual Data_Scaler_white * | duplicate () const override |
| virtual std::ostream & | print (std::ostream &os) const override |
| writes a human-readable identification of the scaler and its configuration; base default writes nothing | |
| Public Member Functions inherited from FST::Data_Scaler< DATATYPE > | |
| Data_Scaler (const int dims=1) | |
| Data_Scaler (const Data_Scaler &ds) | |
| Copy constructor. The base class carries no state of its own; the concrete scalers' copy constructors copy both the configuration and whatever statistics have been learned so far, which is what makes a copy usable for scaling straight away. duplicate() is the virtual entry point that per-split scaling uses to obtain such a copy through a base-class pointer. | |
Protected Attributes | |
| int | learn_loop |
| which of the two learn() passes is active: 1 = accumulating the mean, 2 = accumulating the variance against that mean | |
| IDXTYPE | count1 |
| number of non-missing values fed to learn() during pass 1 (mean accumulation) | |
| DATATYPE | mean |
| running sum during pass 1, finalized to the per-feature mean by startNextLoop() | |
| IDXTYPE | count2 |
| number of non-missing values fed to learn() during pass 2 (variance accumulation) | |
| DATATYPE | stddev |
| running sum of squared deviations during pass 2, finalized to the per-feature standard deviation by startNextLoop() | |
| bool | missing_values |
| whether values equal to _missing_val_code are substituted (scaled to 0) rather than learned/scaled normally | |
| const DATATYPE | _missing_val_code |
| the numerical code that marks a missing value (only meaningful when missing_values is true) | |
Implements data whitening (as result, each feature mean value is 0 with normalized stddev).
The transform is (value-mean)/stddev, learned per feature in two passes: the first accumulates the mean, the second the squared deviations from it. The variance is divided by the number of values (the population convention), not by that number minus one.
|
inlineoverridevirtual |
returns a new independent copy of this scaler (configuration and learned state), owned by the caller; needed by per-split scaling, where each sharing_clone of a data accessor re-learns the transform concurrently and thus needs a private scaler instance. The base implementation throws — a user-derived scaler must override it to be usable for per-split scaling in threaded searches (the built-in scalers all do).
Reimplemented from FST::Data_Scaler< DATATYPE >.
|
overridevirtual |
accumulates value into the mean (pass 1) or its squared deviation from that mean (pass 2), unless it is the missing-value code
Implements FST::Data_Scaler< DATATYPE >.
|
inlineoverridevirtual |
two passes: the variance of pass 2 needs the mean from pass 1
Implements FST::Data_Scaler< DATATYPE >.
|
inlineoverridevirtual |
writes a human-readable identification of the scaler and its configuration; base default writes nothing
Reimplemented from FST::Data_Scaler< DATATYPE >.
|
overridevirtual |
returns (value-mean)/stddev; 0 for a missing value (which is the mean in whitened coordinates) and 0 for a feature with zero standard deviation
Implements FST::Data_Scaler< DATATYPE >.
|
overridevirtual |
the in-place form of scale()
Implements FST::Data_Scaler< DATATYPE >.
|
overridevirtual |
resets the mean accumulator and begins pass 1
Implements FST::Data_Scaler< DATATYPE >.
|
overridevirtual |
finalizes the mean (after pass 1) or the standard deviation (after pass 2); returns false once both passes are done
Implements FST::Data_Scaler< DATATYPE >.