mog_diag_kmeans.h
Go to the documentation of this file.
#ifndef MOG_DIAG_KMEANS_H
#define MOG_DIAG_KMEANS_H
#include <itpp/stat/mog_diag.h>
#include <itpp/itexports.h>
#include <itpp/base/base_exports.h>
namespace itpp
{
class ITPP_EXPORT MOG_diag_kmeans_sup : public MOG_diag
{
public:
MOG_diag_kmeans_sup() { verbose = false; }
~MOG_diag_kmeans_sup() { }
void run(MOG_diag &model_in, Array<vec> &X_in, int max_iter_in = 10, double trust_in = 0.5, bool normalise_in = true, bool verbose_in = false);
protected:
inline double dist(const double * x, const double * y) const;
void assign_to_means();
void recalculate_means();
bool dezombify_means();
double measure_change() const;
void initial_means();
void iterate();
void calc_means();
void calc_covs();
void calc_weights();
void normalise_vectors();
void unnormalise_vectors();
void unnormalise_means();
int max_iter;
double trust;
bool verbose;
int N;
double ** c_X;
Array<vec> means_old;
double ** c_means_old;
Array<ivec> partitions;
int ** c_partitions;
ivec count;
int * c_count;
private:
vec norm_mu;
double * c_norm_mu;
vec norm_sd;
double * c_norm_sd;
vec tmpvec;
double * c_tmpvec;
};
//
// convenience functions
void MOG_diag_kmeans(MOG_diag &model_in, Array<vec> &X_in, int max_iter_in = 10, double trust_in = 0.5, bool normalise_in = true, bool verbose_in = false);
}
#endif // #ifndef MOG_DIAG_KMEANS_H
base_exports.h
Import/Export definitions for some templates defined in base folder.
itpp::Array
General array class.
Definition array.h:105
itpp::MOG_diag_kmeans_sup
support class for MOG_diag_kmeans()
Definition mog_diag_kmeans.h:45
itpp::MOG_diag_kmeans_sup::c_count
int * c_count
'C' pointer to the count vector
Definition mog_diag_kmeans.h:119
itpp::MOG_diag_kmeans_sup::N
int N
number of training vectors
Definition mog_diag_kmeans.h:98
itpp::MOG_diag_kmeans_sup::c_X
double ** c_X
'C' pointers to training vectors
Definition mog_diag_kmeans.h:101
itpp::MOG_diag_kmeans_sup::means_old
Array< vec > means_old
means from the previous iteration, used to measure progress
Definition mog_diag_kmeans.h:104
itpp::MOG_diag_kmeans_sup::~MOG_diag_kmeans_sup
~MOG_diag_kmeans_sup()
Default destructor.
Definition mog_diag_kmeans.h:52
itpp::MOG_diag_kmeans_sup::c_partitions
int ** c_partitions
'C' pointers to partition vectors
Definition mog_diag_kmeans.h:113
itpp::MOG_diag_kmeans_sup::MOG_diag_kmeans_sup
MOG_diag_kmeans_sup()
Default constructor.
Definition mog_diag_kmeans.h:49
itpp::MOG_diag_kmeans_sup::c_means_old
double ** c_means_old
'C' pointers to old means
Definition mog_diag_kmeans.h:107
itpp::MOG_diag_kmeans_sup::max_iter
int max_iter
Maximum number of iterations.
Definition mog_diag_kmeans.h:87
itpp::MOG_diag_kmeans_sup::trust
double trust
trust factor, where 0 <= trust <= 1.
Definition mog_diag_kmeans.h:92
itpp::MOG_diag_kmeans_sup::count
ivec count
keeps a count of the number of vectors assigned to each mean
Definition mog_diag_kmeans.h:116
itpp::MOG_diag_kmeans_sup::partitions
Array< ivec > partitions
contains indices of vectors assigned to each mean
Definition mog_diag_kmeans.h:110
itpp::MOG_diag_kmeans_sup::verbose
bool verbose
Whether we print the progress.
Definition mog_diag_kmeans.h:95
itpp::MOG_diag
Diagonal Mixture of Gaussians (MOG) class.
Definition mog_diag.h:56
itpp::MOG_diag_kmeans
void MOG_diag_kmeans(MOG_diag &model_in, Array< vec > &X_in, int max_iter_in, double trust_in, bool normalise_in, bool verbose_in)
Definition mog_diag_kmeans.cpp:347
mog_diag.h
Diagonal Mixture of Gaussians class - header file.
itpp
itpp namespace
Definition itmex.h:37

Generated on Mon Jun 10 2024 11:49:26 for IT++ by Doxygen 1.9.8