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

The ScaleTransformer is a ITransformer that supports element-based scaling transformations. More...

#include <ScaleTransformer.h>

+ Inheritance diagram for iCub::learningmachine::ScaleTransformer:

Public Member Functions

 ScaleTransformer (unsigned int dom=1)
 Constructor. More...
 
 ScaleTransformer (const ScaleTransformer &other)
 Copy constructor. More...
 
virtual ~ScaleTransformer ()
 Destructor. More...
 
ScaleTransformeroperator= (const ScaleTransformer &other)
 Assignment operator. More...
 
virtual ScaleTransformerclone ()
 Asks the transformer to return a new object of its type. More...
 
virtual yarp::sig::Vector transform (const yarp::sig::Vector &input)
 Transforms an input vector. More...
 
virtual std::string getInfo ()
 Asks the transformer to return a string containing statistics on its operation so far. More...
 
virtual std::string getConfigHelp ()
 Asks the transformer to return a string containing the list of configuration options that it supports. More...
 
virtual void setDomainSize (unsigned int size)
 Mutator for the domain size. More...
 
virtual void setCoDomainSize (unsigned int size)
 Mutator for the codomain size. More...
 
virtual void reset ()
 Forget everything and start over. More...
 
virtual bool configure (yarp::os::Searchable &config)
 
- Public Member Functions inherited from iCub::learningmachine::IFixedSizeTransformer
 IFixedSizeTransformer (unsigned int dom=1, unsigned int cod=1)
 Constructor. More...
 
unsigned int getDomainSize () const
 Returns the size (dimensionality) of the input domain. More...
 
unsigned int getCoDomainSize () const
 Returns the size (dimensionality) of the output domain (codomain). More...
 
- Public Member Functions inherited from iCub::learningmachine::ITransformer
 ITransformer ()
 Constructor. More...
 
virtual ~ITransformer ()
 Destructor (empty). More...
 
std::string getName () const
 Retrieve the name of this transformer. More...
 
void setName (std::string name)
 Set the name of this transformer. More...
 
bool write (yarp::os::ConnectionWriter &connection) const
 
bool read (yarp::os::ConnectionReader &connection)
 
virtual std::string toString ()
 Asks the transformer to return a string serialization. More...
 
virtual bool fromString (const std::string &str)
 Asks the transformer to initialize from a string serialization. More...
 

Protected Member Functions

void deleteAll ()
 Resets the vector of scalers and deletes each element. More...
 
void deleteAll (int size)
 Resets the vector of scalers and deletes each element. More...
 
void setAt (int index, std::string type)
 Sets the scaler at a certain position to a given type. More...
 
IScalergetAt (int index)
 Returns a pointer to the scaler at a certain position. More...
 
void setAll (std::string type)
 Sets all scalers to a given type. More...
 
virtual void writeBottle (yarp::os::Bottle &bot)
 
virtual void readBottle (yarp::os::Bottle &bot)
 Unserializes a transformer from a bottle. More...
 
- Protected Member Functions inherited from iCub::learningmachine::IFixedSizeTransformer
virtual bool checkDomainSize (const yarp::sig::Vector &input)
 Checks whether the input is of the desired dimensionality. More...
 
virtual bool checkCoDomainSize (const yarp::sig::Vector &output)
 Checks whether the output is of the desired dimensionality. More...
 
void validateDomainSizes (const yarp::sig::Vector &input, const yarp::sig::Vector &output)
 Validates whether the input and output are of the desired dimensionality. More...
 
virtual void writeBottle (yarp::os::Bottle &bot) const
 Writes a serialization of the transformer into a bottle. More...
 

Protected Attributes

std::vector< IScaler * > scalers
 The vector of IScaler objects. More...
 
- Protected Attributes inherited from iCub::learningmachine::IFixedSizeTransformer
unsigned int domainSize
 The dimensionality of the input domain. More...
 
unsigned int coDomainSize
 The dimensionality of the output domain (codomain). More...
 
- Protected Attributes inherited from iCub::learningmachine::ITransformer
std::string name
 The name of this type of transformer. More...
 
int sampleCount
 Number of samples transformed since initialization. More...
 

Detailed Description

The ScaleTransformer is a ITransformer that supports element-based scaling transformations.

These transformations include standardization, normalization and other kind of linear scalings based on an offset and scale. The type and configuration can be set for individual elements in the input vectors.

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

Definition at line 46 of file ScaleTransformer.h.

Constructor & Destructor Documentation

◆ ScaleTransformer() [1/2]

iCub::learningmachine::ScaleTransformer::ScaleTransformer ( unsigned int  dom = 1)

Constructor.

Parameters
dominitial domain/codomain size

Definition at line 31 of file ScaleTransformer.cpp.

◆ ScaleTransformer() [2/2]

iCub::learningmachine::ScaleTransformer::ScaleTransformer ( const ScaleTransformer other)

Copy constructor.

Definition at line 40 of file ScaleTransformer.cpp.

◆ ~ScaleTransformer()

iCub::learningmachine::ScaleTransformer::~ScaleTransformer ( )
virtual

Destructor.

Definition at line 36 of file ScaleTransformer.cpp.

Member Function Documentation

◆ clone()

virtual ScaleTransformer* iCub::learningmachine::ScaleTransformer::clone ( )
inlinevirtual

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

Returns
a fresh instance of the current class

Implements iCub::learningmachine::ITransformer.

Definition at line 122 of file ScaleTransformer.h.

◆ configure()

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

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 171 of file ScaleTransformer.cpp.

◆ deleteAll() [1/2]

void iCub::learningmachine::ScaleTransformer::deleteAll ( )
protected

Resets the vector of scalers and deletes each element.

Definition at line 70 of file ScaleTransformer.cpp.

◆ deleteAll() [2/2]

void iCub::learningmachine::ScaleTransformer::deleteAll ( int  size)
protected

Resets the vector of scalers and deletes each element.

Parameters
sizethe desired size of the vector

Definition at line 74 of file ScaleTransformer.cpp.

◆ getAt()

IScaler * iCub::learningmachine::ScaleTransformer::getAt ( int  index)
protected

Returns a pointer to the scaler at a certain position.

Parameters
indexthe index of the scaler
Exceptions
runtimeerror if the index is out of bounds

Definition at line 61 of file ScaleTransformer.cpp.

◆ getConfigHelp()

std::string iCub::learningmachine::ScaleTransformer::getConfigHelp ( )
virtual

Asks the transformer to return a string containing the list of configuration options that it supports.

Returns
an informative description of the configuration options

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 140 of file ScaleTransformer.cpp.

◆ getInfo()

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

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

Returns
the statistics of the transformer

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 128 of file ScaleTransformer.cpp.

◆ operator=()

ScaleTransformer & iCub::learningmachine::ScaleTransformer::operator= ( const ScaleTransformer other)

Assignment operator.

Definition at line 48 of file ScaleTransformer.cpp.

◆ readBottle()

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

Unserializes a transformer from a bottle.

This method is internally referenced by the read method. Typically, subclasses should override this method instead of overriding the read method directly.

Parameters
botthe bottle

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 160 of file ScaleTransformer.cpp.

◆ reset()

void iCub::learningmachine::ScaleTransformer::reset ( )
virtual

Forget everything and start over.

Reimplemented from iCub::learningmachine::ITransformer.

Definition at line 123 of file ScaleTransformer.cpp.

◆ setAll()

void iCub::learningmachine::ScaleTransformer::setAll ( std::string  type)
protected

Sets all scalers to a given type.

Definition at line 93 of file ScaleTransformer.cpp.

◆ setAt()

void iCub::learningmachine::ScaleTransformer::setAt ( int  index,
std::string  type 
)
protected

Sets the scaler at a certain position to a given type.

Parameters
indexthe index of the scaler to change
typethe key identifier of the desired scaler

Definition at line 83 of file ScaleTransformer.cpp.

◆ setCoDomainSize()

void iCub::learningmachine::ScaleTransformer::setCoDomainSize ( unsigned int  size)
virtual

Mutator for the codomain size.

Parameters
sizethe desired codomain size

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 118 of file ScaleTransformer.cpp.

◆ setDomainSize()

void iCub::learningmachine::ScaleTransformer::setDomainSize ( unsigned int  size)
virtual

Mutator for the domain size.

Parameters
sizethe desired domain size

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 111 of file ScaleTransformer.cpp.

◆ transform()

yarp::sig::Vector iCub::learningmachine::ScaleTransformer::transform ( const yarp::sig::Vector &  input)
virtual

Transforms an input vector.

Parameters
inputthe input vector
Returns
the output vector

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 100 of file ScaleTransformer.cpp.

◆ writeBottle()

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

Definition at line 149 of file ScaleTransformer.cpp.

Member Data Documentation

◆ scalers

std::vector<IScaler*> iCub::learningmachine::ScaleTransformer::scalers
protected

The vector of IScaler objects.

Definition at line 51 of file ScaleTransformer.h.


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