1#ifndef FSTDATASCALERWHITE_H
2#define FSTDATASCALERWHITE_H
107template<
typename DATATYPE,
typename IDXTYPE>
117 virtual void learn(
const DATATYPE& value)
override;
119 virtual DATATYPE
scale(
const DATATYPE& value)
override;
138template<
typename DATATYPE,
typename IDXTYPE>
145template<
typename DATATYPE,
typename IDXTYPE>
158 std::ostringstream sos; sos <<
"Data_Scaler_white::startNextLoop() wrong previous loop. (count1=" <<
count1 <<
", count2=" <<
count2 <<
")";
163template<
typename DATATYPE,
typename IDXTYPE>
176 }
else throw fst_error(
"Data_Scaler_white::learn() wrong loop.");
179template<
typename DATATYPE,
typename IDXTYPE>
187template<
typename DATATYPE,
typename IDXTYPE>
Implements data whitening (as result, each feature mean value is 0 with normalized stddev).
Definition data_scaler_white.hpp:108
IDXTYPE count2
number of non-missing values fed to learn() during pass 2 (variance accumulation)
Definition data_scaler_white.hpp:130
Data_Scaler_white(const Data_Scaler_white &ds)
copies configuration and any already-learned statistics
Definition data_scaler_white.hpp:112
const DATATYPE _missing_val_code
the numerical code that marks a missing value (only meaningful when missing_values is true)
Definition data_scaler_white.hpp:135
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 ...
Definition data_scaler_white.hpp:180
virtual Data_Scaler_white * duplicate() const override
Definition data_scaler_white.hpp:122
bool missing_values
whether values equal to _missing_val_code are substituted (scaled to 0) rather than learned/scaled no...
Definition data_scaler_white.hpp:134
int learn_loop
which of the two learn() passes is active: 1 = accumulating the mean, 2 = accumulating the variance a...
Definition data_scaler_white.hpp:127
Data_Scaler_white(const int dims=1)
no missing-value substitution; dims must be 1
Definition data_scaler_white.hpp:110
IDXTYPE count1
number of non-missing values fed to learn() during pass 1 (mean accumulation)
Definition data_scaler_white.hpp:128
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...
Definition data_scaler_white.hpp:111
DATATYPE mean
running sum during pass 1, finalized to the per-feature mean by startNextLoop()
Definition data_scaler_white.hpp:129
virtual void learn(const DATATYPE &value) override
accumulates value into the mean (pass 1) or its squared deviation from that mean (pass 2),...
Definition data_scaler_white.hpp:164
virtual std::ostream & print(std::ostream &os) const override
writes a human-readable identification of the scaler and its configuration; base default writes nothi...
Definition data_scaler_white.hpp:124
virtual bool startNextLoop() override
finalizes the mean (after pass 1) or the standard deviation (after pass 2); returns false once both p...
Definition data_scaler_white.hpp:146
virtual bool startFirstLoop() override
resets the mean accumulator and begins pass 1
Definition data_scaler_white.hpp:139
DATATYPE stddev
running sum of squared deviations during pass 2, finalized to the per-feature standard deviation by s...
Definition data_scaler_white.hpp:131
virtual void scale_inplace(DATATYPE &value) override
the in-place form of scale()
Definition data_scaler_white.hpp:188
virtual int learn_loops() const override
two passes: the variance of pass 2 needs the mean from pass 1
Definition data_scaler_white.hpp:114
Data_Scaler(const int dims=1)
Definition data_scaler.hpp:97
FST4 specific error passing class.
Definition error.hpp:61
Defines interface for data scaling implementations (for use in data accessors).
FST4 specific error passing class.
The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifi...
Definition data_accessor.hpp:80
void notify(const std::string msg)
Prints msg followed by a newline via syncout::print(); a no-op unless the preprocessor macro DEBUG is...
Definition global.hpp:112