From: Francois Fleuret Date: Thu, 28 Mar 2013 17:00:05 +0000 (+0100) Subject: Cosmetics. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=1a7c12097efbe2cb377f4ef39e1564ba1ac42f4b;p=clueless-kmeans.git Cosmetics. --- diff --git a/clusterer.cc b/clusterer.cc index 5418341..d4a70a6 100644 --- a/clusterer.cc +++ b/clusterer.cc @@ -35,8 +35,6 @@ Clusterer::~Clusterer() { } scalar_t Clusterer::distance_to_centroid(scalar_t *x, int k) { - // We take the variance into account + the normalization term. This - // is between k-mean and EM with a diagonal covariance scalar_t dist = 0; for(int d = 0; d < _dim; d++) { dist += sq(_cluster_means[k][d] - x[d]) / (2 * _cluster_var[k][d]); @@ -208,14 +206,17 @@ scalar_t Clusterer::uninformative_lp_cluster_association(int nb_points, scalar_t glp_add_cols(lp, nb_points * _nb_clusters); + // The column for gamma[n][k] point 1<=n<=nb_points and cluster + // 1<=k<=_nb_clusters is nb_points * (k - 1) + n; + // The constraints (A) will be expressed by putting directly bounds // on the variables (i.e. one per column). So we need one row per // (B) constraint, and one per (C) constraint. glp_add_rows(lp, nb_points + _nb_clusters * nb_classes); - // First, we set the weights for the objective function, and the - // constraint on the individual gammas + // First, we set the weights for the objective function, and the (A) + // constraints on the individual gammas for(int k = 1; k <= _nb_clusters; k++) { for(int n = 1; n <= nb_points; n++) {