iCub-main
|
An generalized interface for an ITransformer with a fixed domain and codomain size. More...
#include <IFixedSizeTransformer.h>
Public Member Functions | |
IFixedSizeTransformer (unsigned int dom=1, unsigned int cod=1) | |
Constructor. | |
virtual yarp::sig::Vector | transform (const yarp::sig::Vector &input) |
Transforms an input vector. | |
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). | |
virtual void | setDomainSize (unsigned int size) |
Mutator for the domain size. | |
virtual void | setCoDomainSize (unsigned int size) |
Mutator for the codomain size. | |
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 bool | configure (yarp::os::Searchable &config) |
Public Member Functions inherited from iCub::learningmachine::ITransformer | |
ITransformer () | |
Constructor. | |
virtual | ~ITransformer () |
Destructor (empty). | |
virtual void | reset () |
Forget everything and start over. | |
std::string | getName () const |
Retrieve the name of this transformer. | |
void | setName (std::string name) |
Set the name of this transformer. | |
virtual ITransformer * | clone ()=0 |
Asks the transformer to return a new object of its type. | |
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 | |
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. | |
virtual void | readBottle (yarp::os::Bottle &bot) |
Unserializes a transformer from a bottle. | |
Protected Attributes | |
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. | |
An generalized interface for an ITransformer with a fixed domain and codomain size.
Many simple preprocessing methods fall in this category.
Definition at line 39 of file IFixedSizeTransformer.h.
|
inline |
Constructor.
dom | the initial domain size |
cod | the initial codomain size |
Definition at line 97 of file IFixedSizeTransformer.h.
|
inlineprotectedvirtual |
Checks whether the output is of the desired dimensionality.
output | a sample output |
Definition at line 67 of file IFixedSizeTransformer.h.
|
inlineprotectedvirtual |
Checks whether the input is of the desired dimensionality.
input | a sample input |
Definition at line 57 of file IFixedSizeTransformer.h.
|
virtual |
Reimplemented from iCub::learningmachine::ITransformer.
Reimplemented in iCub::learningmachine::RandomFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::SparseSpectrumFeature.
Definition at line 43 of file IFixedSizeTransformer.cpp.
|
inline |
Returns the size (dimensionality) of the output domain (codomain).
Definition at line 118 of file IFixedSizeTransformer.h.
|
virtual |
Asks the transformer to return a string containing the list of configuration options that it supports.
Reimplemented from iCub::learningmachine::ITransformer.
Reimplemented in iCub::learningmachine::RandomFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::SparseSpectrumFeature.
Definition at line 78 of file IFixedSizeTransformer.cpp.
|
inline |
Returns the size (dimensionality) of the input domain.
Definition at line 109 of file IFixedSizeTransformer.h.
|
virtual |
Asks the transformer to return a string containing statistics on its operation so far.
Reimplemented from iCub::learningmachine::ITransformer.
Reimplemented in iCub::learningmachine::RandomFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::SparseSpectrumFeature.
Definition at line 70 of file IFixedSizeTransformer.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 |
Implements iCub::learningmachine::ITransformer.
Reimplemented in iCub::learningmachine::RandomFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::SparseSpectrumFeature.
Definition at line 64 of file IFixedSizeTransformer.cpp.
|
inlinevirtual |
Mutator for the codomain size.
size | the desired codomain size |
Reimplemented in iCub::learningmachine::RandomFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::SparseSpectrumFeature.
Definition at line 136 of file IFixedSizeTransformer.h.
|
inlinevirtual |
Mutator for the domain size.
size | the desired domain size |
Reimplemented in iCub::learningmachine::RandomFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::SparseSpectrumFeature.
Definition at line 127 of file IFixedSizeTransformer.h.
|
virtual |
Transforms an input vector.
input | the input vector |
Reimplemented from iCub::learningmachine::ITransformer.
Reimplemented in iCub::learningmachine::RandomFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::SparseSpectrumFeature.
Definition at line 27 of file IFixedSizeTransformer.cpp.
|
protected |
Validates whether the input and output are of the desired dimensionality.
An exception will be thrown if this is not the case.
input | a sample input |
output | the corresponding output |
Definition at line 34 of file IFixedSizeTransformer.cpp.
|
protectedvirtual |
Writes a serialization of the transformer into a bottle.
This method is internally referenced by the write method. Typically, subclasses should override this method instead of overriding the write method directly.
bot | the bottle containing the transformer serialization |
Implements iCub::learningmachine::ITransformer.
Reimplemented in iCub::learningmachine::RandomFeature.
Definition at line 59 of file IFixedSizeTransformer.cpp.
|
protected |
The dimensionality of the output domain (codomain).
Definition at line 49 of file IFixedSizeTransformer.h.
|
protected |
The dimensionality of the input domain.
Definition at line 44 of file IFixedSizeTransformer.h.