Home | Develop | Download | Contact
example_decisiontree_create3.cpp
1 
36 #include <iostream>
37 #include <Pds/Ra>
38 #include <Pds/Ml>
39 
40 int main(void)
41 {
42  Pds::Octave::XLabel="x_1";
43  Pds::Octave::YLabel="x_2";
44  Pds::Vector Yp;
45  Pds::IterationConf Conf;
46  Conf.Show=false; Conf.SetMinError(1e-07); Conf.SetAlpha(0.1);
47 
48  // Load training data
49  unsigned int L=1000;
50  Pds::Matrix X;
51  Pds::Vector Y;
52  //Pds::DataSet::Classification::LoadDataBand2(L,X,Y);
53  //Pds::DataSet::Classification::LoadDataBand(L,X,Y);
55 
56 
57  Pds::Octave::Plot::PointsX2DY(X,Y,"testando.m","example_decisiontree_create3_data.png");
58 
59  // =========================================================================
60  // Creando un arbol
62  Pds::DecisionTree Arbol1("logitpar",Conf,X,Y,0.9,3);
63  std::cout<<"Pds::DecisionTree::Counter: "<<Pds::DecisionTree::Counter<<std::endl;
64 
65  // Predict with training data
66  Yp=Arbol1.Predict(X);
67  std::cout<<"Acc_logitpar:\t"<<Pds::Accuracy(Y,Yp)<<"\n\n";
68 
69  Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_decisiontree_create3_conf.png");
70 
71  // =========================================================================
72  // Creando un arbol
74  Pds::DecisionTree Arbol2("k2means",Conf,X,Y,0.9,3);
75  std::cout<<"Pds::DecisionTree::Counter: "<<Pds::DecisionTree::Counter<<std::endl;
76 
77  // Predict with training data
78  Yp=Arbol2.Predict(X);
79  std::cout<<"Acc_k2means:\t"<<Pds::Accuracy(Y,Yp)<<"\n\n";
80 
81  Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_decisiontree_create3_conf2.png");
82 
83  // =========================================================================
84  // Creando un arbol
86  Pds::DecisionTree Arbol3(X,Y,0.9,3);
87  std::cout<<"Pds::DecisionTree::Counter: "<<Pds::DecisionTree::Counter<<std::endl;
88 
89  // Predict with training data
90  Yp=Arbol3.Predict(X);
91  std::cout<<"Acc_ortogon:\t"<<Pds::Accuracy(Y,Yp)<<"\n\n";
92 
93  Pds::Octave::Plot::PointsX2DY(X,Yp,"testando.m","example_decisiontree_create3_ortogonal.png");
94 
95  return 0;
96 }
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....
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