Home | Develop | Download | Contact
example_predictor_kernel_poly_series.cpp

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

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

Para executar o programa:

./example_predictor_kernel_poly_series

Retornando por consola:

FittingNormalMeanSquare():
┌──────────────────────────────┐
│      IterationConf data      │
├──────────────────────────────┤
│           Alpha:        0.1  │
│          Lambda:      0.001  │
│           Gamma:      0.001  │
│        MinError: 1.0000e-05  │
│         MaxIter:       2000  │
├──────────────────────────────┤
│       LastError: 3.6756e-04  │
│        LastIter:       2000  │
└──────────────────────────────┘
W:
-0.024320075954101      3.1699841474204 -0.12720442286797       -31.720700069361        3.2602575935349 121.61511031741 -13.701684580081        -222.33465518409        18.248044218881 118.039967550351.0872473597364  107.39543460859 -9.5362268323132        -9.3357929385893        -7.2291546393516        -74.211418193787        0.071719580073198       -73.248862164127        4.3274326924003 -38.783836773397        5.3496500022782 2.0113031940445 3.9051395452924 31.506145078385 1.4037244883949 46.809916534497 -0.74904383695409       45.859596052448 -2.8480307618258        35.868891197486 -3.3208494339021        20.179930848443 -3.1893008124405        2.9570918812866 -2.0031182135886        -11.50297250092 -0.5618960105253        -22.46155916095 0.15482123926182        -27.955774183592        1.2484689425956 -28.463666693199        2.3339696121975 -25.070539586902        2.945888923173  -17.558976016944        2.0493937985571 -8.0475883310725        1.2461465222999 1.8199797999073 0.2085501389823 10.499473222321 -0.50883090373958       17.107073082046 -1.3165066633858        19.696659164704 -2.0873254806021        18.709281258271 -2.5860224233676        11.104396767261 -1.059351606648 -1.5091681553912        0.014639126878133       -22.064529627474        2.9869868462732

Training :: R2 : 0.76506105044637

Testing  :: R2 : 0.78455366341776
Classification - data


Classification - training


Classification - testing

Código example_predictor_kernel_poly_series.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Vector Yp;
// Generating data
unsigned int L=1000;
unsigned int M=64;
Pds::Matrix X;
Pds::Matrix F;
Pds::Vector Y;
Pds::Octave::Plot::CurveXY(X,Y,"testando.m","example_predictor_kernel_poly_series_data.png");
// Create Predictor
Pds::Predictor Data(Conf,F,Y);
Data.Print("W:\n");
// Predict training data
Yp=Data.Predict(F);
// R2
std::cout<<"\nTraining :: R2 : "<<Y.R2(Yp)<<std::endl;
Pds::Octave::Plot::CurveXYXY(X,Y,X,Yp,"testando.m","example_predictor_kernel_poly_series_training.png");
// Predict testing data
Yp=Data.Predict(F);
// R2
std::cout<<"\nTesting :: R2 : "<<Y.R2(Yp)<<std::endl;
Pds::Octave::Plot::CurveXYXY(X,Y,X,Yp,"testando.m","example_predictor_kernel_poly_series_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 LoadDataFourierSeries(unsigned int L, Pds::Matrix &X, Pds::Vector &Y)
Regresion de datos ajustados por una curva.
Pds::Matrix Polynomial(const Pds::Matrix &X, unsigned int M)
Crea una nueva matriz de "features" kernelizando de forma polinomial.
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