iCub-main
Loading...
Searching...
No Matches
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.
 
 ScaleTransformer (const ScaleTransformer &other)
 Copy constructor.
 
virtual ~ScaleTransformer ()
 Destructor.
 
ScaleTransformeroperator= (const ScaleTransformer &other)
 Assignment operator.
 
virtual ScaleTransformerclone ()
 Asks the transformer to return a new object of its type.
 
virtual yarp::sig::Vector transform (const yarp::sig::Vector &input)
 Transforms an input vector.
 
virtual std::string getInfo ()
 Asks the transformer to return a string containing statistics on its operation so far.
 
virtual std::string getConfigHelp ()
 Asks the transformer to return a string containing the list of configuration options that it supports.
 
virtual void setDomainSize (unsigned int size)
 Mutator for the domain size.
 
virtual void setCoDomainSize (unsigned int size)
 Mutator for the codomain size.
 
virtual void reset ()
 Forget everything and start over.
 
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.
 
unsigned int getDomainSize () const
 Returns the size (dimensionality) of the input domain.
 
unsigned int getCoDomainSize () const
 Returns the size (dimensionality) of the output domain (codomain).
 
- Public Member Functions inherited from iCub::learningmachine::ITransformer
 ITransformer ()
 Constructor.
 
virtual ~ITransformer ()
 Destructor (empty).
 
std::string getName () const
 Retrieve the name of this transformer.
 
void setName (std::string name)
 Set the name of this transformer.
 
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.
 
virtual bool fromString (const std::string &str)
 Asks the transformer to initialize from a string serialization.
 

Protected Member Functions

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

Protected Attributes

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

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: