Programa para el testeo de las funciones.Para compilar o código example_ensembledecisiontree.cpp:
g++ -static -o example_ensembledecisiontree example_ensembledecisiontree.cpp -lpdsmlmm -lpdsramm -lpdsspmm
Para executar o programa:
./example_ensembledecisiontree
Retornando por consola:
Pds::DecisionTree::Counter: 71
Trained bag 0 with 2000 samples obtaining 49 decision.
Trained bag 1 with 2000 samples obtaining 63 decision.
Trained bag 2 with 2000 samples obtaining 65 decision.
Trained bag 3 with 2000 samples obtaining 59 decision.
Trained bag 4 with 2000 samples obtaining 61 decision.
Trained bag 5 with 2000 samples obtaining 57 decision.
Trained bag 6 with 2000 samples obtaining 49 decision.
Trained bag 7 with 2000 samples obtaining 43 decision.
Trained bag 8 with 2000 samples obtaining 63 decision.
Trained bag 9 with 2000 samples obtaining 61 decision.
Trained bag 10 with 2000 samples obtaining 47 decision.
Trained bag 11 with 2000 samples obtaining 45 decision.
Trained bag 12 with 2000 samples obtaining 49 decision.
Trained bag 13 with 2000 samples obtaining 61 decision.
Trained bag 14 with 2000 samples obtaining 51 decision.
Trained bag 15 with 2000 samples obtaining 49 decision.
Classification - data
Classification - simple
Classification - ensemble
Código example_ensembledecisiontree.cpp:
#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Octave::XLabel="x_1";
Pds::Octave::YLabel="x_2";
Pds::Vector Yp;
unsigned int L=2000;
Pds::Matrix X;
Pds::Vector Y;
Pds::Octave::Plot::PointsX2DY(X,Y,"testando.m","example_ensembledecisiontree_data_yinyang.png");
unsigned int StopSamples=3;
unsigned int StopDeep=64;
std::cout<<"Acc:"<<Pds::Accuracy(Y,Yp,0.5)<<"\n";
std::cout<<Pds::Ra::Repeat("*",128)<<"\n\n";
Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_ensembledecisiontree_simple_yinyang.png");
std::cout<<"Acc:"<<Pds::Accuracy(Y,Yp,0.5)<<"\n";
Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_ensembledecisiontree_ensemble_yinyang.png");
return 0;
}
La clase tipo Pds::DecisionTree . Esta clase genera un arbol de decision para unos datos dados....
static unsigned int Counter
La clase tipo Pds::EnsembleDecisionTree . Esta clase genera una matriz de Nlin lineas y 1 columna....
La clase tipo Pds::IterationConf . Esta clase genera una matriz de Nlin lineas y 1 columna....
double Predict(const Pds::Vector &x) const
Evalua el objeto de tipo Pds::DecisionTree.
double Predict(const Pds::Vector &x) const
Evalua el objeto de tipo Pds::EnsembleDecisionTree.
bool SetAlpha(double Alpha)
Coloca el valor alpha.
bool SetMinError(double MinError)
Coloca el valor MinError.
void LoadDataYinYang(unsigned int L, Pds::Matrix &X, Pds::Vector &Y)
Clasificacion de datos separados por mas de una curva.