projects
/
clueless-kmeans.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added README.md
[clueless-kmeans.git]
/
clusterer.h
diff --git
a/clusterer.h
b/clusterer.h
index
ad0c58f
..
6fa5382
100644
(file)
--- a/
clusterer.h
+++ b/
clusterer.h
@@
-1,17
+1,17
@@
/*
/*
- * clueless-kmean
is a variant of k-mean
which enforces balanced
+ * clueless-kmean
s is a variant of k-means
which enforces balanced
* distribution of classes in every cluster
*
* Copyright (c) 2013 Idiap Research Institute, http://www.idiap.ch/
* Written by Francois Fleuret <francois.fleuret@idiap.ch>
*
* distribution of classes in every cluster
*
* Copyright (c) 2013 Idiap Research Institute, http://www.idiap.ch/
* Written by Francois Fleuret <francois.fleuret@idiap.ch>
*
- * This file is part of clueless-kmean.
+ * This file is part of clueless-kmean
s
.
*
*
- * clueless-kmean is free software: you can redistribute it and/or
+ * clueless-kmean
s
is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 3 as published by the Free Software Foundation.
*
* modify it under the terms of the GNU General Public License
* version 3 as published by the Free Software Foundation.
*
- * clueless-kmean is distributed in the hope that it will be useful,
+ * clueless-kmean
s
is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
@@
-31,9
+31,16
@@
class Clusterer {
public:
enum {
public:
enum {
+ // Standard k-mean
STANDARD_ASSOCIATION,
STANDARD_ASSOCIATION,
+ // Same, implemented as a LP problem for sanity check
STANDARD_LP_ASSOCIATION,
STANDARD_LP_ASSOCIATION,
- UNINFORMATIVE_LP_ASSOCIATION
+ // Criterion forcing to have the same distribution of classes in
+ // all clusters
+ UNINFORMATIVE_LP_ASSOCIATION,
+ // Criterion forcing to have the same number of samples of each
+ // class in all clusters
+ UNINFORMATIVE_LP_ASSOCIATION_ABSOLUTE
};
const static int max_nb_iterations = 10;
};
const static int max_nb_iterations = 10;
@@
-42,19
+49,20
@@
public:
int _nb_clusters;
int _dim;
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);
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);
- // Standard hard k-mean association
+ // Standard hard k-mean
s
association
scalar_t baseline_cluster_association(int nb_points, scalar_t **points,
int nb_classes, int *labels,
scalar_t **gamma);
scalar_t baseline_cluster_association(int nb_points, scalar_t **points,
int nb_classes, int *labels,
scalar_t **gamma);
- // Standard k-mean association implemented as an LP optimization
+ // Standard k-mean
s
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 baseline_lp_cluster_association(int nb_points, scalar_t **points,
int nb_classes, int *labels,
@@
-65,7
+73,8
@@
public:
scalar_t uninformative_lp_cluster_association(int nb_points, scalar_t **points,
int nb_classes, int *labels,
scalar_t uninformative_lp_cluster_association(int nb_points, scalar_t **points,
int nb_classes, int *labels,
- scalar_t **gamma);
+ scalar_t **gamma,
+ int absolute_proportion);
void update_clusters(int nb_points, scalar_t **points, scalar_t **gamma);
void update_clusters(int nb_points, scalar_t **points, scalar_t **gamma);