Home | Develop | Download | Contact
example_logisticregression_meansquare_hard.cpp
1 
34 #include <iostream>
35 #include <Pds/Ra>
36 #include <Pds/Ml>
37 
38 
39 int main(void)
40 {
41  // Generating data
42  Pds::Matrix X(Pds::Ra::TextFormat,"../test/hard2-data-x.txt");
43  Pds::Vector Y(Pds::Ra::TextFormat,"../test/hard2-data-y.txt");
44 
49 
50  Pds::Vector W;
51 
52  Pds::IterationConf Conf;
53  Pds::Vector d=Y.BalancedBinaryWeight(0.5);
54 
56 
57  // Create W using training data
58  Conf.Show=true; Conf.SetMinError(1e-07); Conf.SetAlpha(0.1);
59 
61  W.T().Print("W_ms_conf:\n");
62 
63  Pds::Octave::XLabel="x_1";
64  Pds::Octave::YLabel="x_2";
65  Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_ms-conf.png");
66 
67  // Create W using training data
69  W.T().Print("W_ms:\n");
70 
71  Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_ms.png");
72 
74 
75  // Create W using training data
76  Conf.Show=true; Conf.SetMinError(1e-07); Conf.SetAlpha(0.1);
77 
79  W.T().Print("W_ms_conf:\n");
80 
81  Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_wms-conf.png");
82 
83  // Create W using training data
85  W.T().Print("W_ms_w:\n");
86 
87  Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_wms.png");
88 
89 
90  return 0;
91 }
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.
Pds::Vector FittingLogitMeanSquare(Pds::IterationConf &Conf, const Pds::Matrix &X, const Pds::Vector &Y, double Delta=0.0001)
Calculo de pesos.
Pds::Vector FittingLogitWeightedMeanSquare(Pds::IterationConf &Conf, const Pds::Matrix &X, const Pds::Vector &Y, const Pds::Vector &D, double Delta=0.0001)
Calculo de pesos.
std::string YLabel
Texto correspondente a ylabel.
std::string XLabel
Texto correspondente a xlabel.
bool PointsX2DYW(const Pds::Matrix &X, const Pds::Vector &Y, const Pds::Vector &W, const std::string &octfilename, const std::string &imgfilename)
Plot de muestras en 2D en las columnas X, clasificadas de forma binaria con Y>=0.5,...

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed