| Bsoft 2.0.5 Bernard's software package

Functions | Variables
cluster.cpp File Reference

Clustering functions. More...

`#include "cluster.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Functions
long * | k_means (long n, float *data, long k)
| Generate clusters using a K-means algorithm. More...
long * | affin_prop_clustering (Matrix s, long maxit, long convit, double lambda, long &ncluster)
| Generate clusters from a similarity matrix using affinity propagation. More...

## Variables
int | verbose

## Detailed Description

Clustering functions.

Author
  Bernard Heymann

Date
  Created: 20070417
  Modified: 20170724

Definition in file cluster.cpp.

## Function Documentation

## ◆ affin_prop_clustering()

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
  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).

Definition at line 102 of file cluster.cpp.

## ◆ k_means()

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
  long* vector of cluster memberships.

Definition at line 28 of file cluster.cpp.

## Variable Documentation

## ◆ verbose

int verbose