Void data scaler, to bypass data normalization. More...
#include <data_scaler_void.hpp>
Public Member Functions | |
| Data_Scaler_void (const int dims=1) | |
no missing-value substitution (pure bypass); dims must be 1 | |
| Data_Scaler_void (const DATATYPE missing_val_code, const int dims) | |
values equal to missing_val_code are substituted by the per-feature mean; dims must be 1 | |
| Data_Scaler_void (const Data_Scaler_void &ds) | |
| copies configuration and any already-learned statistics | |
| virtual int | learn_loops () const override |
| virtual bool | startFirstLoop () override |
| Resets the mean accumulator and always requests one pass, even in the identity case – the pass is then simply ignored by learn(), which is cheaper than special-casing the caller's loop. | |
| virtual bool | startNextLoop () override |
| one pass is always enough | |
| virtual void | learn (const DATATYPE &value) override |
accumulates value into the per-feature mean, unless it is the missing-value code or substitution is off | |
| virtual DATATYPE | scale (const DATATYPE &value) override |
returns value unchanged, or the per-feature mean of the available values if value is the missing-value code (0 if none were available) | |
| virtual void | scale_inplace (DATATYPE &value) override |
the in-place form of scale(); leaves value untouched unless it is the missing-value code | |
| virtual Data_Scaler_void * | 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 | |
| bool | missing_values |
| whether values equal to _missing_val_code are substituted by the per-feature mean; when false, scale()/scale_inplace() are pure identity | |
| const DATATYPE | _missing_val_code |
| the numerical code that marks a missing value (only meaningful when missing_values is true) | |
| long | count |
| number of non-missing values fed to learn() for the current feature | |
| DATATYPE | sum |
| running sum of non-missing values, used to derive avg | |
| DATATYPE | avg |
| running mean of non-missing values (sum/count); substituted for missing entries | |
Void data scaler, to bypass data normalization.
Constructed without a missing-value code it is the identity: scale() returns its argument and the values reach the criteria exactly as loaded.
|
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 per-feature mean, unless it is the missing-value code or substitution is off
Implements FST::Data_Scaler< DATATYPE >.
|
inlineoverridevirtual |
1 when substituting missing values (the mean must be accumulated), 0 for the pure identity
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 unchanged, or the per-feature mean of the available values if value is the missing-value code (0 if none were available)
Implements FST::Data_Scaler< DATATYPE >.
|
overridevirtual |
the in-place form of scale(); leaves value untouched unless it is the missing-value code
Implements FST::Data_Scaler< DATATYPE >.
|
inlineoverridevirtual |
Resets the mean accumulator and always requests one pass, even in the identity case – the pass is then simply ignored by learn(), which is cheaper than special-casing the caller's loop.
Implements FST::Data_Scaler< DATATYPE >.
|
inlineoverridevirtual |
one pass is always enough
Implements FST::Data_Scaler< DATATYPE >.