iCub-main
|
Implementation of Random Feature preprocessing. More...
#include <RandomFeature.h>
Public Member Functions | |
RandomFeature (unsigned int dom=1, unsigned int cod=1, double gamma=1.) | |
Constructor. | |
virtual | ~RandomFeature () |
Destructor (empty). | |
virtual RandomFeature * | clone () |
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) |
virtual double | getGamma () const |
Accessor for the gamma parameter. | |
virtual void | setGamma (double g) |
Mutator for the gamma parameter. | |
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 | |
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 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. | |
Protected Attributes | |
double | gamma |
Gamma parameter, analoguous to same parameter in RBF kernel. | |
yarp::sig::Matrix | W |
Projection matrix W. | |
yarp::sig::Vector | b |
Bias vector b. | |
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. | |
Implementation of Random Feature preprocessing.
See: Random Features for Large-Scale Kernel Machines. Ali Rahimi and Ben Recht. In Neural Information Processing Systems (NIPS) 2007.
Definition at line 45 of file RandomFeature.h.
iCub::learningmachine::RandomFeature::RandomFeature | ( | unsigned int | dom = 1 , |
unsigned int | cod = 1 , |
||
double | gamma = 1. |
||
) |
Constructor.
dom | initial domain size |
cod | initial codomain size |
g | initial value for \gamma |
Definition at line 39 of file RandomFeature.cpp.
|
inlinevirtual |
Destructor (empty).
Definition at line 85 of file RandomFeature.h.
|
inlinevirtual |
Asks the transformer to return a new object of its type.
Implements iCub::learningmachine::ITransformer.
Definition at line 90 of file RandomFeature.h.
|
virtual |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 111 of file RandomFeature.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 104 of file RandomFeature.cpp.
|
inlinevirtual |
|
virtual |
Asks the transformer to return a string containing statistics on its operation so far.
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 97 of file RandomFeature.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 88 of file RandomFeature.cpp.
|
virtual |
Forget everything and start over.
Reimplemented from iCub::learningmachine::ITransformer.
Definition at line 69 of file RandomFeature.cpp.
|
virtual |
Mutator for the codomain size.
size | the desired codomain size |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 62 of file RandomFeature.cpp.
|
virtual |
Mutator for the domain size.
size | the desired domain size |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 55 of file RandomFeature.cpp.
|
inlinevirtual |
Mutator for the gamma parameter.
g | the desired gamma. |
Definition at line 143 of file RandomFeature.h.
|
virtual |
Transforms an input vector.
input | the input vector |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 47 of file RandomFeature.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 |
Reimplemented from iCub::learningmachine::IFixedSizeTransformer.
Definition at line 82 of file RandomFeature.cpp.
|
protected |
Bias vector b.
Definition at line 60 of file RandomFeature.h.
|
protected |
Gamma parameter, analoguous to same parameter in RBF kernel.
Definition at line 50 of file RandomFeature.h.
|
protected |
Projection matrix W.
Definition at line 55 of file RandomFeature.h.