12#include <yarp/sig/Vector.h> 
   13#include <yarp/math/Rand.h> 
   21using namespace yarp::sig;
 
   23std::pair<Vector, Vector> 
createSample(
double min_in, 
double max_in) {
 
   24  std::pair<Vector, Vector> sample;
 
   25  sample.first.resize(1);
 
   26  sample.second.resize(1);
 
   27  double input = yarp::math::Rand::scalar(min_in, max_in);
 
   28  sample.first[0] = input;
 
   29  sample.second[0] = std::sin(input);
 
 
   43int main(
int argc, 
char** argv) {
 
   44  std::cout << 
"LearningMachine library example (direct)" << std::endl;
 
   57    sample.first[0] = scaler.
transform(sample.first[0]);
 
   66  for(
int i = 0; i < 
NO_TEST; i++) {
 
   68    sample.first[0] = scaler.
transform(sample.first[0]);
 
   70    double diff = sample.second[0] - prediction.
getPrediction()[0];
 
   74  std::cout << 
"MSE on test data after " << 
NO_TEST << 
" samples: " << MSE << std::endl;
 
 
A class that implements preprocessing based on a fixed range of outputs to a fixed range of outputs.
 
virtual double transform(double val)
Transforms a single sample value according to the state of the scaler.
 
This is basic implementation of the LSSVM algorithms.
 
virtual void feedSample(const yarp::sig::Vector &input, const yarp::sig::Vector &output)
Provide the learning machine with an example of the desired mapping.
 
Prediction predict(const yarp::sig::Vector &input)
Ask the learning machine to predict the output for a given input.
 
virtual void train()
Train the learning machine on the examples that have been supplied so far.
 
virtual RBFKernel * getKernel()
Accessor for the kernel.
 
A class that represents a prediction result.
 
yarp::sig::Vector getPrediction()
Accessor for the expected value of the prediction.
 
virtual void setGamma(double g)
 
std::pair< Vector, Vector > createSample()