25namespace learningmachine {
28 if(
this == &other)
return *
this;
30 this->IMachineLearner::operator=(other);
31 this->filename = other.filename;
32 this->precision = other.precision;
33 this->sampleCount = other.sampleCount;
41 if(!this->stream.is_open()) {
43 this->stream.open(this->filename.c_str(), std::ios_base::out | std::ios_base::app);
45 this->stream.precision(this->precision);
49 for(
size_t i = 0; i < input.size(); i++) {
50 if(i > 0) this->stream <<
" ";
51 this->stream << std::setw(this->precision + 4) << input[i];
56 for(
size_t i = 0; i < output.size(); i++) {
57 if(i > 0) this->stream <<
" ";
58 this->stream << std::setw(this->precision + 4) << output[i] <<
" ";
62 this->stream << std::endl;
69 std::ostringstream buffer;
71 buffer <<
"Filename: " << this->filename << std::endl;
72 buffer <<
"Precision: " << this->precision << std::endl;
73 buffer <<
"Sample Count: " << this->sampleCount << std::endl;
78 bot.addString(this->filename.c_str());
79 bot.addInt32(this->precision);
83 this->precision = bot.pop().asInt32();
84 this->filename = bot.pop().asString().c_str();
88 std::ostringstream buffer;
90 buffer <<
" filename name Filename to write to" << std::endl;
91 buffer <<
" precision n Number of digits precision for doubles" << std::endl;
99 if(config.find(
"filename").isString()) {
101 this->filename = config.find(
"filename").asString().c_str();
106 if(config.find(
"precision").isInt32()) {
107 this->precision = config.find(
"precision").asInt32();
This 'machine learner' demonstrates how the IMachineLearner interface can be used to easily record sa...
virtual void feedSample(const yarp::sig::Vector &input, const yarp::sig::Vector &output)
Provide the learning machine with an example of the desired mapping.
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a machine from a bottle.
void reset()
Forget everything and start over.
virtual void writeBottle(yarp::os::Bottle &bot) const
Writes a serialization of the machine into a bottle.
DatasetRecorder & operator=(const DatasetRecorder &other)
Assignment operator.
virtual std::string getConfigHelp()
Asks the learning machine to return a string containing the list of configuration options that it sup...
virtual bool configure(yarp::os::Searchable &config)
Change parameters.
std::string getInfo()
Asks the learning machine to return a string containing information on its operation so far.
virtual std::string getConfigHelp()
Asks the learning machine to return a string containing the list of configuration options that it sup...
virtual std::string getInfo()
Asks the learning machine to return a string containing information on its operation so far.
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.