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. More... | |
virtual | ~RandomFeature () |
Destructor (empty). More... | |
virtual RandomFeature * | 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) |
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... | |
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.