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

An generalized interface for an ITransformer with a fixed domain and codomain size. More...

#include <IFixedSizeTransformer.h>

+ Inheritance diagram for iCub::learningmachine::IFixedSizeTransformer:

Public Member Functions

 IFixedSizeTransformer (unsigned int dom=1, unsigned int cod=1)
 Constructor. More...
 
virtual yarp::sig::Vector transform (const yarp::sig::Vector &input)
 Transforms an input vector. 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...
 
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 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 bool configure (yarp::os::Searchable &config)
 
- Public Member Functions inherited from iCub::learningmachine::ITransformer
 ITransformer ()
 Constructor. More...
 
virtual ~ITransformer ()
 Destructor (empty). More...
 
virtual void reset ()
 Forget everything and start over. More...
 
std::string getName () const
 Retrieve the name of this transformer. More...
 
void setName (std::string name)
 Set the name of this transformer. More...
 
virtual ITransformerclone ()=0
 Asks the transformer to return a new object of its type. 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

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...
 
virtual void readBottle (yarp::os::Bottle &bot)
 Unserializes a transformer from a bottle. More...
 

Protected Attributes

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

An generalized interface for an ITransformer with a fixed domain and codomain size.

Many simple preprocessing methods fall in this category.

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

Definition at line 39 of file IFixedSizeTransformer.h.

Constructor & Destructor Documentation

◆ IFixedSizeTransformer()

iCub::learningmachine::IFixedSizeTransformer::IFixedSizeTransformer ( unsigned int  dom = 1,
unsigned int  cod = 1 
)
inline

Constructor.

Parameters
domthe initial domain size
codthe initial codomain size

Definition at line 97 of file IFixedSizeTransformer.h.

Member Function Documentation

◆ checkCoDomainSize()

virtual bool iCub::learningmachine::IFixedSizeTransformer::checkCoDomainSize ( const yarp::sig::Vector &  output)
inlineprotectedvirtual

Checks whether the output is of the desired dimensionality.

Parameters
outputa sample output
Returns
true if the dimensionality is correct

Definition at line 67 of file IFixedSizeTransformer.h.

◆ checkDomainSize()

virtual bool iCub::learningmachine::IFixedSizeTransformer::checkDomainSize ( const yarp::sig::Vector &  input)
inlineprotectedvirtual

Checks whether the input is of the desired dimensionality.

Parameters
inputa sample input
Returns
true if the dimensionality is correct

Definition at line 57 of file IFixedSizeTransformer.h.

◆ configure()

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

◆ getCoDomainSize()

unsigned int iCub::learningmachine::IFixedSizeTransformer::getCoDomainSize ( ) const
inline

Returns the size (dimensionality) of the output domain (codomain).

Returns
the size of the codomain

Definition at line 118 of file IFixedSizeTransformer.h.

◆ getConfigHelp()

std::string iCub::learningmachine::IFixedSizeTransformer::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::ITransformer.

Reimplemented in iCub::learningmachine::SparseSpectrumFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::RandomFeature.

Definition at line 78 of file IFixedSizeTransformer.cpp.

◆ getDomainSize()

unsigned int iCub::learningmachine::IFixedSizeTransformer::getDomainSize ( ) const
inline

Returns the size (dimensionality) of the input domain.

Returns
the size of the input domain

Definition at line 109 of file IFixedSizeTransformer.h.

◆ getInfo()

std::string iCub::learningmachine::IFixedSizeTransformer::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::ITransformer.

Reimplemented in iCub::learningmachine::SparseSpectrumFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::RandomFeature.

Definition at line 70 of file IFixedSizeTransformer.cpp.

◆ readBottle()

void iCub::learningmachine::IFixedSizeTransformer::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

Implements iCub::learningmachine::ITransformer.

Reimplemented in iCub::learningmachine::SparseSpectrumFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::RandomFeature.

Definition at line 64 of file IFixedSizeTransformer.cpp.

◆ setCoDomainSize()

virtual void iCub::learningmachine::IFixedSizeTransformer::setCoDomainSize ( unsigned int  size)
inlinevirtual

Mutator for the codomain size.

Parameters
sizethe desired codomain size

Reimplemented in iCub::learningmachine::SparseSpectrumFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::RandomFeature.

Definition at line 136 of file IFixedSizeTransformer.h.

◆ setDomainSize()

virtual void iCub::learningmachine::IFixedSizeTransformer::setDomainSize ( unsigned int  size)
inlinevirtual

Mutator for the domain size.

Parameters
sizethe desired domain size

Reimplemented in iCub::learningmachine::SparseSpectrumFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::RandomFeature.

Definition at line 127 of file IFixedSizeTransformer.h.

◆ transform()

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

Transforms an input vector.

Parameters
inputthe input vector
Returns
the output vector

Reimplemented from iCub::learningmachine::ITransformer.

Reimplemented in iCub::learningmachine::SparseSpectrumFeature, iCub::learningmachine::ScaleTransformer, and iCub::learningmachine::RandomFeature.

Definition at line 27 of file IFixedSizeTransformer.cpp.

◆ validateDomainSizes()

void iCub::learningmachine::IFixedSizeTransformer::validateDomainSizes ( const yarp::sig::Vector &  input,
const yarp::sig::Vector &  output 
)
protected

Validates whether the input and output are of the desired dimensionality.

An exception will be thrown if this is not the case.

Parameters
inputa sample input
outputthe corresponding output

Definition at line 34 of file IFixedSizeTransformer.cpp.

◆ writeBottle()

void iCub::learningmachine::IFixedSizeTransformer::writeBottle ( yarp::os::Bottle &  bot) const
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.

Parameters
botthe bottle containing the transformer serialization

Implements iCub::learningmachine::ITransformer.

Reimplemented in iCub::learningmachine::RandomFeature.

Definition at line 59 of file IFixedSizeTransformer.cpp.

Member Data Documentation

◆ coDomainSize

unsigned int iCub::learningmachine::IFixedSizeTransformer::coDomainSize
protected

The dimensionality of the output domain (codomain).

Definition at line 49 of file IFixedSizeTransformer.h.

◆ domainSize

unsigned int iCub::learningmachine::IFixedSizeTransformer::domainSize
protected

The dimensionality of the input domain.

Definition at line 44 of file IFixedSizeTransformer.h.


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