Programa para el testeo de las funciones.Para compilar o código example_anomaly_detection_gaussian.cpp:
g++ -static -o example_anomaly_detection_gaussian example_anomaly_detection_gaussian.cpp -lpdsnnmm
Para executar o programa:
./example_anomaly_detection_gaussian
Retornando por consola:
X.Size():
10000 2
Mu:
1.9993438130135 2.9991585071564
Sigma:
0.25065509848827 -0.0021491969165038
-0.0021491969165038 0.24650951245711
X:
2 3
-2 4
-1 4
P(X):
0.64029520150186
1.3391319908642e-15
1.4971038691836e-09
Código example_anomaly_detection_gaussian.cpp:
#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
unsigned int L=10000;
Pds::Matrix X;
Pds::Matrix Mu;
Pds::Matrix Sigma;
Pds::Vector P;
X=Pds::MergeHor({2+0.5*Pds::RandN(L,1),3+0.5*Pds::RandN(L,1)});
X.Size().Print("X.Size():\n");
Mu.Print("\nMu:\n");
Sigma.Print("\nSigma:\n");
X=Pds::Matrix("2 3\n-2 4\n-1 4");
X.Print("\nX:\n");
P.Print("\nP(X):\n");
return 0;
}
Pds::Vector MGaussianPDF(const Pds::Matrix &X, const Pds::Matrix &Mu, const Pds::Matrix &Sigma)
Calcula la probability density function (PDF) de una funcion gaussiana multivariada,...
bool MGaussianDensityEstimation(const Pds::Matrix &X, Pds::Matrix &Mu, Pds::Matrix &Sigma)
Calcula los parametros para la probability density function (PDF) de una funcion gaussiana multivaria...