Clustering functions.
More...
#include "cluster.h"
#include "utilities.h"
|
vector< long > | k_means (long n, float *data, long k) |
| Generate clusters using a K-means algorithm. More...
|
|
vector< long > | affin_prop_clustering (Matrix s, long maxit, long convit, double lambda, long &ncluster) |
| Generate clusters from a similarity matrix using affinity propagation.
More...
|
|
Clustering functions.
- Author
- Bernard Heymann
- Date
- Created: 20070417
-
Modified: 20210508
◆ affin_prop_clustering()
vector< long > affin_prop_clustering |
( |
Matrix |
s, |
|
|
long |
maxit, |
|
|
long |
convit, |
|
|
double |
lambda, |
|
|
long & |
ncluster |
|
) |
| |
Generate clusters from a similarity matrix using affinity propagation.
- Parameters
-
s | n x n similarity matrix. |
maxit | maximum iterations. |
convit | convergence iterations. |
lambda | damping factor. |
&ncluster | number of clusters. |
- Returns
- vector<long> vector of cluster memberships.
Frey, B. J. and D. Dueck (2007). "Clustering by passing messages between
data points." Science 315(5814): 972-6.
The clustering algorithm proceeds iteratively for a given maximum iterations.
If the cluster solution does not change for a given number of iterations
(convit), convergence is assumed and the function finishes.
The damping factor should be ~0.5, or at least between 0.1 and 0.9.
For larger damping factors, more convergence iterations are required.
The diagonal of the matrix should be set to preferences for exemplars
(typically the average or median of the similarities).
◆ k_means()
vector< long > k_means |
( |
long |
n, |
|
|
float * |
data, |
|
|
long |
k |
|
) |
| |
Generate clusters using a K-means algorithm.
- Parameters
-
n | number of data elements. |
*data | floating point array. |
k | number of classes. |
- Returns
- vector<long> vector of cluster memberships.
◆ verbose