shark::NormalizeComponentsUnitVariance< DataType > Class Template Reference

Train a linear model to normalize the components of a dataset to unit variance, and optionally to zero mean. More...

#include <shark/Algorithms/Trainers/NormalizeComponentsUnitVariance.h>

+ Inheritance diagram for shark::NormalizeComponentsUnitVariance< DataType >:

Public Member Functions

 NormalizeComponentsUnitVariance (bool zeroMean)
 Constructor. More...
 
std::string name () const
 From INameable: return the class name. More...
 
void train (Normalizer< DataType > &model, UnlabeledData< DataType > const &input)
 
- Public Member Functions inherited from shark::AbstractUnsupervisedTrainer< Normalizer< DataType > >
virtual void train (ModelType &model, const UnlabeledData< InputType > &inputset)=0
 Core of the Trainer interface. More...
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
virtual void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
virtual void write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Attributes

bool m_zeroMean
 

Additional Inherited Members

- Public Types inherited from shark::AbstractUnsupervisedTrainer< Normalizer< DataType > >
typedef Normalizer< DataType > ModelType
 
typedef Normalizer< DataType > ::InputType InputType
 

Detailed Description

template<class DataType = RealVector>
class shark::NormalizeComponentsUnitVariance< DataType >

Train a linear model to normalize the components of a dataset to unit variance, and optionally to zero mean.

Normalizing the components of a dataset works via training a Normalizer model. This model is then applied to the dataset in order to perform the normalization. The same model can be applied to different datasets.
The typical use case is that the Normalizer model is trained on the training data. Later, as "test" data comes in, the same model is used, of course without being recalibrated. Thus, the model used for normalization must be independent of the dataset it was trained on.
Note that subtracting the mean destroys sparsity. Therefore this feature is turned off by default. If you have non-sparse data and you need to move data to zero mean, not only to unit variance, then enable the flag zeroMean in the constructor.

Definition at line 74 of file NormalizeComponentsUnitVariance.h.

Constructor & Destructor Documentation

◆ NormalizeComponentsUnitVariance()

template<class DataType = RealVector>
shark::NormalizeComponentsUnitVariance< DataType >::NormalizeComponentsUnitVariance ( bool  zeroMean)
inline

Constructor.

The normalizer scales the data to unit variance. It can also remove the mean of the data. This is usually desired, e.g., for neural network training. Note however that this feature is sometimes undesirable since it can destroy sparsity.
Parameters
zeroMeanenable or disable data mean removal

Definition at line 89 of file NormalizeComponentsUnitVariance.h.

Member Function Documentation

◆ name()

template<class DataType = RealVector>
std::string shark::NormalizeComponentsUnitVariance< DataType >::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 93 of file NormalizeComponentsUnitVariance.h.

◆ train()

Member Data Documentation

◆ m_zeroMean

template<class DataType = RealVector>
bool shark::NormalizeComponentsUnitVariance< DataType >::m_zeroMean
protected

The documentation for this class was generated from the following file: