iCub-main
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iCub::learningmachine::Standardizer Class Reference

A class that implements standardization as a preprocessing step. More...

#include <Standardizer.h>

+ Inheritance diagram for iCub::learningmachine::Standardizer:

Public Member Functions

 Standardizer (double m=0., double s=1.)
 Constructor. More...
 
virtual void update (double val)
 Feeds a single sample into the scaler, so that it can use this sample to update the offset and scale. More...
 
virtual std::string getInfo ()
 Asks the learning machine to return a string containing statistics on its operation so far. More...
 
virtual bool configure (yarp::os::Searchable &config)
 
Standardizerclone ()
 Asks the scaler to return a new object of its type. More...
 
virtual double getDesiredMean ()
 Accessor for the desired mean. More...
 
virtual void setDesiredMean (double m)
 Mutator for the desired mean. More...
 
virtual double getDesiredStd ()
 Accessor for the desired standard deviation. More...
 
virtual void setDesiredStd (double s)
 Mutator for the desired standard deviation. More...
 
- Public Member Functions inherited from iCub::learningmachine::IScaler
 IScaler (double s=1., double o=0.)
 Constructor. More...
 
virtual ~IScaler ()
 Destructor (empty). More...
 
virtual double transform (double val)
 Transforms a single sample value according to the state of the scaler. More...
 
virtual double unTransform (double val)
 Untransforms a single sample value according to the state of the scaler. More...
 
std::string getName () const
 Retrieve the name of this scaler. More...
 
void setName (std::string name)
 Set the name of this machine learning technique. More...
 
virtual void setUpdateEnabled (bool u)
 Mutator for the update state. More...
 
virtual bool getUpdateEnabled ()
 Accessor for the update state. More...
 
virtual std::string toString ()
 Asks the scaler to return a string serialization. More...
 
virtual bool fromString (const std::string &str)
 Asks the scaler to initialize from a string serialization. More...
 

Protected Member Functions

virtual void writeBottle (yarp::os::Bottle &bot)
 Writes a serialization of the scaler into a bottle. More...
 
virtual void readBottle (yarp::os::Bottle &bot)
 Unserializes a scaler from a bottle. More...
 

Protected Attributes

int noSamples
 The number of samples that have been received so far. More...
 
double mean
 Desired mean for the output distribution. More...
 
double std
 Desired standard deviation for the output distribution. More...
 
double runningMean
 Running mean based on the samples seen so far. More...
 
double runningStd
 Running standard deviation based on the samples seen so far. More...
 
double squaredErrors
 Temporary variable that counts the sum of the squared errors. More...
 
- Protected Attributes inherited from iCub::learningmachine::IScaler
double offset
 The offset for the linear transformation. More...
 
double scale
 The scale for the linear transformation. More...
 
std::string name
 The name of this type of scaler. More...
 
bool updateEnabled
 Boolean indicating whether the scaler has to update each sample. More...
 

Detailed Description

A class that implements standardization as a preprocessing step.

Standardization is the process of converting all samples such that the set has a zero mean and unit standard deviation. In this particular implementation both the mean and standard deviation are calculated using a 'running' computation.

See also
iCub::learningmachine::IScaler
Author
Arjan Gijsberts

Definition at line 43 of file Standardizer.h.

Constructor & Destructor Documentation

◆ Standardizer()

iCub::learningmachine::Standardizer::Standardizer ( double  m = 0.,
double  s = 1. 
)

Constructor.

Parameters
mdesired output mean
sdesired output standard deviation

Definition at line 32 of file Standardizer.cpp.

Member Function Documentation

◆ clone()

Standardizer* iCub::learningmachine::Standardizer::clone ( )
inlinevirtual

Asks the scaler to return a new object of its type.

Returns
a fresh instance of the specified type

Implements iCub::learningmachine::IScaler.

Definition at line 112 of file Standardizer.h.

◆ configure()

bool iCub::learningmachine::Standardizer::configure ( yarp::os::Searchable &  config)
virtual

Reimplemented from iCub::learningmachine::IScaler.

Definition at line 80 of file Standardizer.cpp.

◆ getDesiredMean()

virtual double iCub::learningmachine::Standardizer::getDesiredMean ( )
inlinevirtual

Accessor for the desired mean.

Definition at line 119 of file Standardizer.h.

◆ getDesiredStd()

virtual double iCub::learningmachine::Standardizer::getDesiredStd ( )
inlinevirtual

Accessor for the desired standard deviation.

Definition at line 131 of file Standardizer.h.

◆ getInfo()

std::string iCub::learningmachine::Standardizer::getInfo ( )
virtual

Asks the learning machine to return a string containing statistics on its operation so far.

Returns
the statistics of the machine

Reimplemented from iCub::learningmachine::IScaler.

Definition at line 56 of file Standardizer.cpp.

◆ readBottle()

void iCub::learningmachine::Standardizer::readBottle ( yarp::os::Bottle &  bot)
protectedvirtual

Unserializes a scaler from a bottle.

Parameters
botthe bottle

Reimplemented from iCub::learningmachine::IScaler.

Definition at line 72 of file Standardizer.cpp.

◆ setDesiredMean()

virtual void iCub::learningmachine::Standardizer::setDesiredMean ( double  m)
inlinevirtual

Mutator for the desired mean.

Parameters
mthe new mean

Definition at line 126 of file Standardizer.h.

◆ setDesiredStd()

virtual void iCub::learningmachine::Standardizer::setDesiredStd ( double  s)
inlinevirtual

Mutator for the desired standard deviation.

Parameters
sthe new standard deviation

Definition at line 138 of file Standardizer.h.

◆ update()

void iCub::learningmachine::Standardizer::update ( double  val)
virtual

Feeds a single sample into the scaler, so that it can use this sample to update the offset and scale.

Parameters
valuethe sample value

Reimplemented from iCub::learningmachine::IScaler.

Definition at line 39 of file Standardizer.cpp.

◆ writeBottle()

void iCub::learningmachine::Standardizer::writeBottle ( yarp::os::Bottle &  bot)
protectedvirtual

Writes a serialization of the scaler into a bottle.

Parameters
botthe bottle

Reimplemented from iCub::learningmachine::IScaler.

Definition at line 64 of file Standardizer.cpp.

Member Data Documentation

◆ mean

double iCub::learningmachine::Standardizer::mean
protected

Desired mean for the output distribution.

Definition at line 53 of file Standardizer.h.

◆ noSamples

int iCub::learningmachine::Standardizer::noSamples
protected

The number of samples that have been received so far.

Definition at line 48 of file Standardizer.h.

◆ runningMean

double iCub::learningmachine::Standardizer::runningMean
protected

Running mean based on the samples seen so far.

Definition at line 63 of file Standardizer.h.

◆ runningStd

double iCub::learningmachine::Standardizer::runningStd
protected

Running standard deviation based on the samples seen so far.

Definition at line 68 of file Standardizer.h.

◆ squaredErrors

double iCub::learningmachine::Standardizer::squaredErrors
protected

Temporary variable that counts the sum of the squared errors.

Definition at line 73 of file Standardizer.h.

◆ std

double iCub::learningmachine::Standardizer::std
protected

Desired standard deviation for the output distribution.

Definition at line 58 of file Standardizer.h.


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