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

Implementation of Random Feature preprocessing. More...

#include <RandomFeature.h>

+ Inheritance diagram for iCub::learningmachine::RandomFeature:

Public Member Functions

 RandomFeature (unsigned int dom=1, unsigned int cod=1, double gamma=1.)
 Constructor. More...
 
virtual ~RandomFeature ()
 Destructor (empty). More...
 
virtual RandomFeatureclone ()
 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)
 
virtual double getGamma () const
 Accessor for the gamma parameter. More...
 
virtual void setGamma (double g)
 Mutator for the gamma parameter. More...
 
- 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

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 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...
 

Protected Attributes

double gamma
 Gamma parameter, analoguous to same parameter in RBF kernel. More...
 
yarp::sig::Matrix W
 Projection matrix W. More...
 
yarp::sig::Vector b
 Bias vector b. 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

Implementation of Random Feature preprocessing.

See also
iCub::learningmachine::SparseSpectrumFeature

See: Random Features for Large-Scale Kernel Machines. Ali Rahimi and Ben Recht. In Neural Information Processing Systems (NIPS) 2007.

Author
Arjan Gijsberts

Definition at line 45 of file RandomFeature.h.

Constructor & Destructor Documentation

◆ RandomFeature()

iCub::learningmachine::RandomFeature::RandomFeature ( unsigned int  dom = 1,
unsigned int  cod = 1,
double  gamma = 1. 
)

Constructor.

Parameters
dominitial domain size
codinitial codomain size
ginitial value for \gamma

Definition at line 39 of file RandomFeature.cpp.

◆ ~RandomFeature()

virtual iCub::learningmachine::RandomFeature::~RandomFeature ( )
inlinevirtual

Destructor (empty).

Definition at line 85 of file RandomFeature.h.

Member Function Documentation

◆ clone()

virtual RandomFeature* iCub::learningmachine::RandomFeature::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 90 of file RandomFeature.h.

◆ configure()

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

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 111 of file RandomFeature.cpp.

◆ getConfigHelp()

std::string iCub::learningmachine::RandomFeature::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 104 of file RandomFeature.cpp.

◆ getGamma()

virtual double iCub::learningmachine::RandomFeature::getGamma ( ) const
inlinevirtual

Accessor for the gamma parameter.

Returns
gamma.

Definition at line 134 of file RandomFeature.h.

◆ getInfo()

std::string iCub::learningmachine::RandomFeature::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 97 of file RandomFeature.cpp.

◆ readBottle()

void iCub::learningmachine::RandomFeature::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 88 of file RandomFeature.cpp.

◆ reset()

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

Forget everything and start over.

Reimplemented from iCub::learningmachine::ITransformer.

Definition at line 69 of file RandomFeature.cpp.

◆ setCoDomainSize()

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

Mutator for the codomain size.

Parameters
sizethe desired codomain size

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 62 of file RandomFeature.cpp.

◆ setDomainSize()

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

Mutator for the domain size.

Parameters
sizethe desired domain size

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 55 of file RandomFeature.cpp.

◆ setGamma()

virtual void iCub::learningmachine::RandomFeature::setGamma ( double  g)
inlinevirtual

Mutator for the gamma parameter.

Parameters
gthe desired gamma.

Definition at line 143 of file RandomFeature.h.

◆ transform()

yarp::sig::Vector iCub::learningmachine::RandomFeature::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 47 of file RandomFeature.cpp.

◆ writeBottle()

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

Reimplemented from iCub::learningmachine::IFixedSizeTransformer.

Definition at line 82 of file RandomFeature.cpp.

Member Data Documentation

◆ b

yarp::sig::Vector iCub::learningmachine::RandomFeature::b
protected

Bias vector b.

Definition at line 60 of file RandomFeature.h.

◆ gamma

double iCub::learningmachine::RandomFeature::gamma
protected

Gamma parameter, analoguous to same parameter in RBF kernel.

Definition at line 50 of file RandomFeature.h.

◆ W

yarp::sig::Matrix iCub::learningmachine::RandomFeature::W
protected

Projection matrix W.

Definition at line 55 of file RandomFeature.h.


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