X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=clusterer.h;h=a0a29f97d62dfecd107f5fc3c762c2888f9e1596;hb=056eef1e23b3f6e5218b7bc3800f6412a3f97bfc;hp=065dd3ffab9bb4cf5841180c00049580f69479e3;hpb=e83a6c8bc9daf4e36a82796cd7ca4ed7f6d686da;p=clueless-kmeans.git diff --git a/clusterer.h b/clusterer.h index 065dd3f..a0a29f9 100644 --- a/clusterer.h +++ b/clusterer.h @@ -30,34 +30,39 @@ class Clusterer { public: - enum { STANDARD_ASSOCIATION, STANDARD_LP_ASSOCIATION, UNINFORMATIVE_LP_ASSOCIATION }; + enum { + STANDARD_ASSOCIATION, + STANDARD_LP_ASSOCIATION, + UNINFORMATIVE_LP_ASSOCIATION + }; const static int max_nb_iterations = 10; const static scalar_t min_iteration_improvement = 0.999; + const static scalar_t min_cluster_variance = 0.01f; int _nb_clusters; int _dim; + scalar_t **_cluster_means, **_cluster_var; scalar_t distance_to_centroid(scalar_t *x, int k); void initialize_clusters(int nb_points, scalar_t **points); - // Does the standard hard k-mean association + // Standard hard k-mean association scalar_t baseline_cluster_association(int nb_points, scalar_t **points, int nb_classes, int *labels, scalar_t **gamma); - // Does the same with an LP formulation, as a sanity check + // Standard k-mean association implemented as an LP optimization scalar_t baseline_lp_cluster_association(int nb_points, scalar_t **points, int nb_classes, int *labels, scalar_t **gamma); - // Does the association under constraints that each cluster gets - // associated clusters with the same class proportion as the overall - // training set + // Association under the constraint that each cluster gets the same + // class proportions as the overall training set scalar_t uninformative_lp_cluster_association(int nb_points, scalar_t **points, int nb_classes, int *labels,