49 GMM(
int nomix,
int dim);
50 GMM(std::string filename);
51 void init_from_vq(
const vec &codebook,
int dim);
53 void init(
const vec &w_in,
const mat &m_in,
const mat &sigma_in);
54 void load(std::string filename);
55 void save(std::string filename);
56 void set_weight(
const vec &weights,
bool compflag =
true);
57 void set_weight(
int i,
double weight,
bool compflag =
true);
58 void set_mean(
const mat &m_in);
59 void set_mean(
const vec &means,
bool compflag =
true);
60 void set_mean(
int i,
const vec &means,
bool compflag =
true);
61 void set_covariance(
const mat &sigma_in);
62 void set_covariance(
const vec &covariances,
bool compflag =
true);
63 void set_covariance(
int i,
const vec &covariances,
bool compflag =
true);
64 int get_no_mixtures();
65 int get_no_gaussians()
const {
return M; }
68 double get_weight(
int i);
72 vec get_covariance(
int i);
73 void marginalize(
int d_new);
74 void join(
const GMM &newgmm);
76 double likelihood(
const vec &x);
77 double likelihood_aposteriori(
const vec &x,
int mixture);
78 vec likelihood_aposteriori(
const vec &x);
84 void compute_internals();
85 vec normweight, normexp;
88 inline void GMM::set_weight(
const vec &weights,
bool compflag) {w = weights;
if (compflag) compute_internals(); }
89 inline void GMM::set_weight(
int i,
double weight,
bool compflag) {w(i) =
weight;
if (compflag) compute_internals(); }
90 inline void GMM::set_mean(
const vec &means,
bool compflag) {m = means;
if (compflag) compute_internals(); }
91 inline void GMM::set_covariance(
const vec &covariances,
bool compflag) {sigma = covariances;
if (compflag) compute_internals(); }
92 inline int GMM::get_dimension() {
return d;}
93 inline vec GMM::get_weight() {
return w;}
94 inline double GMM::get_weight(
int i) {
return w(i);}
95 inline vec GMM::get_mean() {
return m;}
96 inline vec GMM::get_mean(
int i) {
return m.mid(i*d, d);}
97 inline vec GMM::get_covariance() {
return sigma;}
98 inline vec GMM::get_covariance(
int i) {
return sigma.mid(i*d, d);}
100 GMM gmmtrain(Array<vec> &TrainingData,
int M,
int NOITER = 30,
bool VERBOSE =
true);
106 #endif // #ifndef GMM_H