abstract class, defines interface for data scaling implementations (for use in data accessors) More...
#include <data_scaler.hpp>
Public Member Functions | |
| 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. | |
| virtual int | learn_loops () const =0 |
| Number of full data passes learn() needs before scale() is valid. 1 for scalers whose statistic is a single-pass reduction (to01's min/max); 2 for scalers whose second-order statistic depends on the first (white's stddev needs the mean from pass 1 first); 0 for a scaler that has nothing to learn. | |
| virtual bool | startFirstLoop ()=0 |
| virtual bool | startNextLoop ()=0 |
| virtual void | learn (const DATATYPE &value)=0 |
| virtual DATATYPE | scale (const DATATYPE &value)=0 |
| return the scaled value | |
| virtual void | scale_inplace (DATATYPE &value)=0 |
| scale the value in place | |
| virtual Data_Scaler * | duplicate () const |
| virtual std::ostream & | print (std::ostream &os) const |
| writes a human-readable identification of the scaler and its configuration; base default writes nothing | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Data_Scaler< DATATYPE > &ds) |
Streams a scaler's print() to os. | |
abstract class, defines interface for data scaling implementations (for use in data accessors)
|
inline |
dims is accepted for concrete-scaler constructor symmetry; the base class does not use it
|
inlinevirtual |
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 in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.
|
pure virtual |
Feeds one data value into the accumulator for the current pass (see startFirstLoop()/startNextLoop()). All values of ONE feature are fed, then the pass sequence restarts for the next feature.
Implemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.
|
pure virtual |
Number of full data passes learn() needs before scale() is valid. 1 for scalers whose statistic is a single-pass reduction (to01's min/max); 2 for scalers whose second-order statistic depends on the first (white's stddev needs the mean from pass 1 first); 0 for a scaler that has nothing to learn.
Implemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.
|
inlinevirtual |
writes a human-readable identification of the scaler and its configuration; base default writes nothing
Reimplemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.
|
pure virtual |
return the scaled value
Implemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.
|
pure virtual |
scale the value in place
Implemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.
|
pure virtual |
Begins the first learning pass: resets accumulators. Returns false to request no learning pass at all (callers then go straight to scale() with the scaler's default state).
Implemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.
|
pure virtual |
Finalizes the just-completed pass (e.g. dividing an accumulated sum into a mean) and begins the next one. Returns false once no further pass is needed, ending the caller's loop.
Implemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.