Home | Develop | Download | Contact
example_logisticregression_w0.cpp

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

g++ -static -o example_logisticregression_w0 example_logisticregression_w0.cpp -lpdsmlmm

Para executar o programa:

./example_logisticregression_w0

Retornando por consola:

W0:
-0.19761437373493       0.69316252037071        0.69316252037071
W0:
1.3531290967742 1       1
W0:
-0.42161372586748       -1      0.63252353657496
Clasification - data


Clasification - Pds::LogisticModel::GetW0MeanMethod(X)


Clasification - Pds::LogisticModel::GetW0CornerMeanMethod(X)


Clasification - Pds::LogisticModel::GetW0MeanSquareMethod(X)

Código example_logisticregression_w0.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Vector Yp;
// Generating data
Pds::Matrix X(Pds::Ra::TextFormat,"../test/hard-data-x.txt");
Pds::Vector Y(Pds::Ra::TextFormat,"../test/hard-data-y.txt");
Pds::Vector W0;
Pds::Octave::Plot::PointsX2DY(X,Y,"testando.m","example_logisticregression_w0_data.png");
// Create W0 using training data
W0.T().Print("W0:\n");
Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando.m","example_logisticregression_w0_mean.png");
// Create W0 using training data
W0.T().Print("W0:\n");
Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando_corner.m","example_logisticregression_w0_meancorner.png");
// Create W0 using training data
W0.T().Print("W0:\n");
Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando.m","example_logisticregression_w0_meansquare.png");
return 0;
}
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.
Pds::Vector GetW0CornerMeanMethod(const Pds::Matrix &X)
Obtiene de forma rapida un vector inicial para usar en regresion logistica.
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,...
bool PointsX2DY(const Pds::Matrix &X, const Pds::Vector &Y, 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