30 #ifndef GRT_GAUSSIAN_MIXTURE_MODELS_HEADER
31 #define GRT_GAUSSIAN_MIXTURE_MODELS_HEADER
33 #include "../../CoreModules/Clusterer.h"
174 bool computeInvAndDet();
175 inline void SWAP(UINT &a,UINT &b);
176 inline Float SQR(
const Float v){
return v*v; }
183 const UINT N = (UINT)x.size();
187 y = (1.0/pow(TWO_PI,N/2.0)) * (1.0/pow(det[clusterIndex],0.5));
192 temp[i] += (x[j]-mu[clusterIndex][j]) * invSigma[clusterIndex][j][i];
194 sum += (x[i]-mu[clusterIndex][i]) * temp[i];
197 return ( y*exp( -0.5*sum ) );
216 #endif //GRT_GAUSSIAN_MIXTURE_MODELS_HEADER
MatrixFloat getSigma(const UINT k) const
virtual bool train_(MatrixFloat &trainingData)
virtual bool predict_(VectorDouble &inputVector)
VectorDouble lndets
A vector holding the log detminants of SIGMA'k.
Float loglike
The current loglikelihood value of the models given the data.
virtual bool loadModelFromFile(std::fstream &file)
MatrixFloat getMu() const
virtual bool saveModelToFile(std::fstream &file) const
virtual bool saveModelToFile(std::string filename) const
MatrixFloat mu
A matrix holding the estimated mean values of each Gaussian.
UINT numClusters
Number of clusters in the model.
Vector< MatrixFloat > getSigma() const
virtual bool loadModelFromFile(std::string filename)
GaussianMixtureModels & operator=(const GaussianMixtureModels &rhs)
VectorDouble frac
A vector holding the P(k)'s.
virtual bool deepCopyFrom(const Clusterer *clusterer)
GaussianMixtureModels(const UINT numClusters=10, const UINT minNumEpochs=5, const UINT maxNumEpochs=1000, const Float minChange=1.0e-5)
virtual ~GaussianMixtureModels()
MatrixFloat resp
The responsibility matrix.
UINT numTrainingSamples
The number of samples in the training data.