Home | Develop | Download | Contact
example_decisiontree_create3.cpp

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

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

Para executar o programa:

./example_decisiontree_create3

Retornando por consola:

Pds::DecisionTree::Counter: 58
Acc_logitpar:   0.9785

Pds::DecisionTree::Counter: 37
Acc_k2means:    0.9905

Pds::DecisionTree::Counter: 59
Acc_ortogon:    0.9865
example_decisiontree_create3_data.png


example_decisiontree_create3_conf.png


example_decisiontree_create3_conf2.png


example_decisiontree_create3_ortogonal.png

Código example_decisiontree_create3.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;
Conf.Show=false; Conf.SetMinError(1e-07); Conf.SetAlpha(0.1);
// Load training data
unsigned int L=1000;
Pds::Matrix X;
Pds::Vector Y;
//Pds::DataSet::Classification::LoadDataBand2(L,X,Y);
//Pds::DataSet::Classification::LoadDataBand(L,X,Y);
Pds::Octave::Plot::PointsX2DY(X,Y,"testando.m","example_decisiontree_create3_data.png");
// =========================================================================
// Creando un arbol
Pds::DecisionTree Arbol1("logitpar",Conf,X,Y,0.9,3);
std::cout<<"Pds::DecisionTree::Counter: "<<Pds::DecisionTree::Counter<<std::endl;
// Predict with training data
Yp=Arbol1.Predict(X);
std::cout<<"Acc_logitpar:\t"<<Pds::Accuracy(Y,Yp)<<"\n\n";
Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_decisiontree_create3_conf.png");
// =========================================================================
// Creando un arbol
Pds::DecisionTree Arbol2("k2means",Conf,X,Y,0.9,3);
std::cout<<"Pds::DecisionTree::Counter: "<<Pds::DecisionTree::Counter<<std::endl;
// Predict with training data
Yp=Arbol2.Predict(X);
std::cout<<"Acc_k2means:\t"<<Pds::Accuracy(Y,Yp)<<"\n\n";
Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_decisiontree_create3_conf2.png");
// =========================================================================
// Creando un arbol
Pds::DecisionTree Arbol3(X,Y,0.9,3);
std::cout<<"Pds::DecisionTree::Counter: "<<Pds::DecisionTree::Counter<<std::endl;
// Predict with training data
Yp=Arbol3.Predict(X);
std::cout<<"Acc_ortogon:\t"<<Pds::Accuracy(Y,Yp)<<"\n\n";
Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_decisiontree_create3_ortogonal.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::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.
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.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed