Home | Develop | Download | Contact
example_predictor_predict.cpp

Programa para el testeo de las funciones.Para compilar o código example_predictor_predict.cpp:

g++ -static -o example_predictor_predict example_predictor_predict.cpp -lpdsmlmm -lpdsramm -lpdsspmm

Para executar o programa:

./example_predictor_predict

Retornando por consola:

W:
-0.00016956747675257    0.99510037048118

Training :: R2 : 0.96912476229416

Testing  :: R2 : 0.97149469355756
Classification - data


Classification - training


Classification - testing

Código example_predictor_predict.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Vector Yp;
// Generating data
unsigned int L=1000;
Pds::Matrix X;
Pds::Vector Y;
Pds::Octave::Plot::CurveXY(X,Y,"testando.m","example_predictor_predict_data.png");
// Create Predictor
Pds::Predictor Data(Conf,X,Y);
Data.Print("W:\n");
// Predict training data
Yp=Data.Predict(X);
// Testing W with training data set
std::cout<<"\nTraining :: R2 : "<<Y.R2(Yp)<<std::endl;
Pds::Octave::Plot::CurveXYXY(X,Y,X,Yp,"testando.m","example_predictor_predict_training.png");
// Predict testing data
Yp=Data.Predict(X);
// Testing W with training data set
std::cout<<"\nTesting :: R2 : "<<Y.R2(Yp)<<std::endl;
Pds::Octave::Plot::CurveXYXY(X,Y,X,Yp,"testando.m","example_predictor_predict_testing.png");
return 0;
}
La clase tipo Pds::IterationConf . Esta clase genera una matriz de Nlin lineas y 1 columna....
La clase tipo Pds::Predictor . Esta clase genera una matriz de Nlin lineas y 1 columna....
Definition: Predictor.hpp:63
void LoadDataLine(unsigned int L, Pds::Matrix &X, Pds::Vector &Y)
Regresion de datos ajustados por una linea.
void Print(std::string str="") const
Imprime en pantalla el contenido del vector de pesos después del texto indicado en str.
double Predict(const std::initializer_list< double > list) const
Evalua el objeto de tipo Pds::Predictor.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed