Home | Develop | Download | Contact
example_probability_gaussian2.cpp

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

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

Para executar o programa:

./example_probability_gaussian2

Retornando por consola:

X.Size():
2000    2
Mu:
-0.0099711798182032     0.017250260987729
Sigma:
0.980653
Anomaly detection - data
Anomaly detection - probability

Código example_probability_gaussian2.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Octave::XLabel="x1";
Pds::Octave::YLabel="x2";
Pds::Octave::DAspect=true;
unsigned int L=2000;
Pds::Matrix X;
Pds::Matrix Mu;
double Sigma;
Pds::Vector P;
// Generating data X=[x1 x2]
X=Pds::MergeHor({ Pds::RandN(L,1) , Pds::RandN(L,1) });
Pds::Octave::Plot::PointsX2D(X,"testando.m","example_probability_gaussian2_data.png");
// Mu, Sigma estimation
Sigma=sqrt(X.CovMatrix(Mu).Det());
std::cout<<"X.Size():\n"<<X.Size()<<"\n";
std::cout<<"Mu:\n"<<Mu;
std::cout<<"Sigma:\n"<<Sigma<<"\n";
// Anomaly detection
Pds::Octave::Plot::ScatterX2DY(X,P,"testando.m","example_probability_gaussian2_prob.png");
return 0;
}
Pds::Vector MGaussian(const Pds::Matrix &X, const Pds::Vector &Mu, const double &Sigma)
Evalua la "probability density function" de la funcion gaussiana multivariada, usando ,...

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed