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

Void data scaler, to bypass data normalization. More...

#include <data_scaler_void.hpp>

Inheritance diagram for FST::Data_Scaler_void< DATATYPE >:
FST::Data_Scaler< DATATYPE >

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

Detailed Description

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

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.

Note
Constructed WITH a missing-value code it is no longer a pure bypass. Values equal to that code are then replaced by the mean of the values that are available for the same feature – the raw mean, since no normalization is applied on top of it. If EVERY value of a feature is missing, the substitute is 0. Values that are not missing still pass through unchanged.
Examples
demo10.cpp, demo52t.cpp, and demo55.cpp.

Member Function Documentation

◆ duplicate()

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

◆ learn()

template<typename DATATYPE>
void FST::Data_Scaler_void< DATATYPE >::learn ( const DATATYPE & value)
overridevirtual

accumulates value into the per-feature mean, unless it is the missing-value code or substitution is off

Implements FST::Data_Scaler< DATATYPE >.

◆ learn_loops()

template<typename DATATYPE>
virtual int FST::Data_Scaler_void< DATATYPE >::learn_loops ( ) const
inlineoverridevirtual

1 when substituting missing values (the mean must be accumulated), 0 for the pure identity

Implements FST::Data_Scaler< DATATYPE >.

◆ print()

template<typename DATATYPE>
virtual std::ostream & FST::Data_Scaler_void< DATATYPE >::print ( std::ostream & os) const
inlineoverridevirtual

writes a human-readable identification of the scaler and its configuration; base default writes nothing

Reimplemented from FST::Data_Scaler< DATATYPE >.

◆ scale()

template<typename DATATYPE>
DATATYPE FST::Data_Scaler_void< DATATYPE >::scale ( const DATATYPE & value)
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 >.

◆ scale_inplace()

template<typename DATATYPE>
void FST::Data_Scaler_void< DATATYPE >::scale_inplace ( DATATYPE & value)
overridevirtual

the in-place form of scale(); leaves value untouched unless it is the missing-value code

Implements FST::Data_Scaler< DATATYPE >.

◆ startFirstLoop()

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

◆ startNextLoop()

template<typename DATATYPE>
virtual bool FST::Data_Scaler_void< DATATYPE >::startNextLoop ( )
inlineoverridevirtual

one pass is always enough

Implements FST::Data_Scaler< DATATYPE >.


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.