Feature Selection Toolbox FST4
UTIA · Czech Academy of Sciences
Loading...
Searching...
No Matches
FST::Data_Scaler< DATATYPE > Class Template Referenceabstract

abstract class, defines interface for data scaling implementations (for use in data accessors) More...

#include <data_scaler.hpp>

Inheritance diagram for FST::Data_Scaler< DATATYPE >:
FST::Data_Scaler_to01< DATATYPE > FST::Data_Scaler_void< DATATYPE > FST::Data_Scaler_white< DATATYPE, IDXTYPE >

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.

Detailed Description

template<typename DATATYPE>
class FST::Data_Scaler< DATATYPE >

abstract class, defines interface for data scaling implementations (for use in data accessors)

Constructor & Destructor Documentation

◆ Data_Scaler()

template<typename DATATYPE>
FST::Data_Scaler< DATATYPE >::Data_Scaler ( const int dims = 1)
inline

dims is accepted for concrete-scaler constructor symmetry; the base class does not use it

Member Function Documentation

◆ duplicate()

template<typename DATATYPE>
virtual Data_Scaler * FST::Data_Scaler< DATATYPE >::duplicate ( ) const
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 >.

◆ learn()

template<typename DATATYPE>
virtual void FST::Data_Scaler< DATATYPE >::learn ( const DATATYPE & value)
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 >.

◆ learn_loops()

template<typename DATATYPE>
virtual int FST::Data_Scaler< DATATYPE >::learn_loops ( ) const
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.

Note
This is a declaration of the scaler's need, for a caller that wants to know it in advance. It is NOT what drives the passes: the caller runs for(bool more=startFirstLoop(); more; more=startNextLoop()), so the pass count is whatever that pair returns. A scaler reporting 0 loops may still ask for one pass and ignore its values.

Implemented in FST::Data_Scaler_to01< DATATYPE >, FST::Data_Scaler_void< DATATYPE >, and FST::Data_Scaler_white< DATATYPE, IDXTYPE >.

◆ print()

template<typename DATATYPE>
virtual std::ostream & FST::Data_Scaler< DATATYPE >::print ( std::ostream & os) const
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 >.

◆ scale()

template<typename DATATYPE>
virtual DATATYPE FST::Data_Scaler< DATATYPE >::scale ( const DATATYPE & value)
pure virtual

◆ scale_inplace()

template<typename DATATYPE>
virtual void FST::Data_Scaler< DATATYPE >::scale_inplace ( DATATYPE & value)
pure virtual

◆ startFirstLoop()

template<typename DATATYPE>
virtual bool FST::Data_Scaler< DATATYPE >::startFirstLoop ( )
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 >.

◆ startNextLoop()

template<typename DATATYPE>
virtual bool FST::Data_Scaler< DATATYPE >::startNextLoop ( )
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 >.


The documentation for this class was generated from the following file:
Copyright © 2000–present ÚTIA, Institute of Information Theory and Automation of the Czech Academy of Sciences · Contacts · This site sets no cookies and uses no analytics.