iCub-main
|
The ScaleTransformer is a ITransformer that supports element-based scaling transformations. More...
#include <ScaleTransformer.h>
Public Member Functions | |
ScaleTransformer (unsigned int dom=1) | |
Constructor. More... | |
ScaleTransformer (const ScaleTransformer &other) | |
Copy constructor. More... | |
virtual | ~ScaleTransformer () |
Destructor. More... | |
ScaleTransformer & | operator= (const ScaleTransformer &other) |
Assignment operator. More... | |
virtual ScaleTransformer * | clone () |
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... | |
IScaler * | getAt (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... | |
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.
Definition at line 46 of file ScaleTransformer.h.
iCub::learningmachine::ScaleTransformer::ScaleTransformer | ( | unsigned int | dom = 1 | ) |
Constructor.
dom | initial domain/codomain size |
Definition at line 31 of file ScaleTransformer.cpp.
iCub::learningmachine::ScaleTransformer::ScaleTransformer | ( | const ScaleTransformer & | other | ) |
Copy constructor.
Definition at line 40 of file ScaleTransformer.cpp.
|
virtual |
Destructor.
Definition at line 36 of file ScaleTransformer.cpp.
|
inlinevirtual |
Asks the transformer to return a new object of its type.
Implements iCub::learningmachine::ITransformer.
Definition at line 122 of file ScaleTransformer.h.
|
virtual |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 171 of file ScaleTransformer.cpp.
|
protected |
Resets the vector of scalers and deletes each element.
Definition at line 70 of file ScaleTransformer.cpp.
|
protected |
Resets the vector of scalers and deletes each element.
size | the desired size of the vector |
Definition at line 74 of file ScaleTransformer.cpp.
|
protected |
Returns a pointer to the scaler at a certain position.
index | the index of the scaler |
runtime | error if the index is out of bounds |
Definition at line 61 of file ScaleTransformer.cpp.
|
virtual |
Asks the transformer to return a string containing the list of configuration options that it supports.
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 140 of file ScaleTransformer.cpp.
|
virtual |
Asks the transformer to return a string containing statistics on its operation so far.
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 128 of file ScaleTransformer.cpp.
ScaleTransformer & iCub::learningmachine::ScaleTransformer::operator= | ( | const ScaleTransformer & | other | ) |
Assignment operator.
Definition at line 48 of file ScaleTransformer.cpp.
|
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.
bot | the bottle |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 160 of file ScaleTransformer.cpp.
|
virtual |
Forget everything and start over.
Reimplemented from iCub::learningmachine::ITransformer.
Definition at line 123 of file ScaleTransformer.cpp.
|
protected |
Sets all scalers to a given type.
Definition at line 93 of file ScaleTransformer.cpp.
|
protected |
Sets the scaler at a certain position to a given type.
index | the index of the scaler to change |
type | the key identifier of the desired scaler |
Definition at line 83 of file ScaleTransformer.cpp.
|
virtual |
Mutator for the codomain size.
size | the desired codomain size |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 118 of file ScaleTransformer.cpp.
|
virtual |
Mutator for the domain size.
size | the desired domain size |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 111 of file ScaleTransformer.cpp.
|
virtual |
Transforms an input vector.
input | the input vector |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 100 of file ScaleTransformer.cpp.
|
protectedvirtual |
Definition at line 149 of file ScaleTransformer.cpp.
|
protected |
The vector of IScaler objects.
Definition at line 51 of file ScaleTransformer.h.