This class implements spectral clustering.
More...
|
| ClusteringSpectral (const Matrix &affinityMatrix, const unsigned int numberCluster) |
| Determines the symmetric Laplacian matrix of input given and computes the eigen system of the Laplacian matrix. More...
|
|
std::vector< Indices32 > | clusterRotation (const unsigned int iterations=100u, const Scalar convergenceThreshold=Scalar(0.0001)) |
| Performances the actual clustering. More...
|
|
This class implements spectral clustering.
◆ ClusteringSpectral()
Ocean::ClusteringSpectral::ClusteringSpectral |
( |
const Matrix & |
affinityMatrix, |
|
|
const unsigned int |
numberCluster |
|
) |
| |
Determines the symmetric Laplacian matrix of input given and computes the eigen system of the Laplacian matrix.
- Parameters
-
affinityMatrix | a square weight matrix derived from similarity matrix (must be non-negative) |
numberCluster | number of cluster to be returned (0, infinity) |
◆ clusterRotation()
std::vector<Indices32> Ocean::ClusteringSpectral::clusterRotation |
( |
const unsigned int |
iterations = 100u , |
|
|
const Scalar |
convergenceThreshold = Scalar(0.0001) |
|
) |
| |
Performances the actual clustering.
The algorithm is implemented according to "Huang et al. Spectral rotation versus K-means in spectral clustering. AAAI'13".
- Parameters
-
iterations | Upper limit of iterations to be performed [1, infinity) |
convergenceThreshold | Differential threshold used as convergence criteria (0, infinity) |
- Returns
- Indices of cluster elements (number of cluster was given in constructor)
◆ determineLaplacianMatrix()
static Matrix Ocean::ClusteringSpectral::determineLaplacianMatrix |
( |
const Matrix & |
affinityMatrix | ) |
|
|
staticprotected |
Determines unnormalized graph Laplacian matrix.
L = D - W. W is the weight matrix and D is a diagonal matrix containing the row sum of W
- Parameters
-
affinityMatrix | a square weight matrix derived from similarity matrix (must be non-negative) |
- Returns
- Laplacian matrix
◆ determineRandomWalkLaplacianMatrix()
template<bool tSimplify>
static Matrix Ocean::ClusteringSpectral::determineRandomWalkLaplacianMatrix |
( |
const Matrix & |
affinityMatrix | ) |
|
|
staticprotected |
Determines normalized graph Laplacian matrix closely connected to a random walk.
L = I - D^{-1} * W. W is the weight matrix, I is the identity matrix and D is a diagonal matrix containing the row sum of W
- Template Parameters
-
tSimplify | indicating whether a simplified version is used, then substraction with identity matrix is obmitted. Mathematically wrong but commonly used |
- Parameters
-
affinityMatrix | a square weight matrix derived from similarity matrix (must be non-negative) |
- Returns
- Laplacian matrix
◆ determineSymmetricLaplacianMatrix()
template<bool tSimplify>
static Matrix Ocean::ClusteringSpectral::determineSymmetricLaplacianMatrix |
( |
const Matrix & |
affinityMatrix | ) |
|
|
staticprotected |
Determines symmetric (normalized) graph Laplacian matrix.
L = I - D^{-1/2} * W * D^{-1/2}. W is the weight matrix, I is the identity matrix and D is a diagonal matrix containing the row sum of W
- Template Parameters
-
tSimplify | indicating whether a simplified version is used, then substraction with identity matrix is obmitted. Mathematically wrong but commonly used |
- Parameters
-
affinityMatrix | a square weight matrix derived from similarity matrix (must be non-negative) |
- Returns
- Laplacian matrix
◆ pairSortDescending()
template<typename T >
bool Ocean::ClusteringSpectral::pairSortDescending |
( |
const std::pair< T, MatrixT< T >> & |
firstElem, |
|
|
const std::pair< T, MatrixT< T >> & |
secondElem |
|
) |
| |
|
inlinestaticprotected |
Sorts a list of eigenvectors with corresponding eigenvalues in descending order.
- Parameters
-
firstElem | First pair of eigenvalue and eigenvector |
secondElem | Second pair of eigenvalue and eigenvector |
- Returns
- first eigenvalue is greater than eigenvalue of second element
◆ reducedEigenvectors
Matrix Ocean::ClusteringSpectral::reducedEigenvectors |
|
protected |
Column matrix of eigen vectors ordered by eigen values and reduced to [numberCluster] vectors.
The documentation for this class was generated from the following file: