Home | Develop | Download | Contact
example_logisticregression_w0.cpp
1 
32 #include <iostream>
33 #include <Pds/Ra>
34 #include <Pds/Ml>
35 
36 int main(void)
37 {
38  Pds::Ra::Randomize();
39  Pds::Vector Yp;
40 
41  // Generating data
42  Pds::Matrix X(Pds::Ra::TextFormat,"../test/hard-data-x.txt");
43  Pds::Vector Y(Pds::Ra::TextFormat,"../test/hard-data-y.txt");
44  Pds::Vector W0;
45 
46  Pds::Octave::DAspect=true;
47  Pds::Octave::XLabel="x_1";
48  Pds::Octave::YLabel="x_2";
49  Pds::Octave::Plot::PointsX2DY(X,Y,"testando.m","example_logisticregression_w0_data.png");
50 
51  // Create W0 using training data
53  W0.T().Print("W0=Pds::LogisticModel::GetW0MeanMethod(X);\n");
54 
56 
57  Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando.m","example_logisticregression_w0_mean.png");
58 
59  // Create W0 using training data
61  W0.T().Print("W0=Pds::LogisticModel::GetW0CornerMeanMethod(X);\n");
62 
64 
65  Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando_corner.m","example_logisticregression_w0_meancorner.png");
66 
67  // Create W0 using training data
69  W0.T().Print("W0=Pds::LogisticModel::GetW0MeanSquareMethod(X);\n");
70 
72 
73  Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando.m","example_logisticregression_w0_meansquare.png");
74 
75  return 0;
76 }
Pds::Vector GetW0CornerMeanMethod(const Pds::Matrix &X, double Delta=0.001)
Obtiene de forma rapida un vector inicial para usar en regresion logistica.
Pds::Vector Classify(const Pds::Vector &W, const Pds::Matrix &X)
Calculo del resultado del clasificador.
Pds::Vector GetW0MeanMethod(const Pds::Matrix &X)
Obtiene de forma rapida un vector inicial para usar en regresion logistica.
Pds::Vector GetW0MeanSquareMethod(const Pds::Matrix &X)
Obtiene de forma rapida un vector inicial para usar en regresion logistica.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed