libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
crn::SpectralClustering Class Reference

Spectral clustering. More...

#include <CRNSpectralClustering.h>

Public Member Functions

 SpectralClustering (const SpectralClustering &)=delete
 
 SpectralClustering (SpectralClustering &&)=default
 
SpectralClusteringoperator= (const SpectralClustering &)=delete
 
SpectralClusteringoperator= (SpectralClustering &&)=default
 
const std::multimap< double,
MatrixDouble > & 
GetEigenpairs () const noexcept
 Gets the data projected on each coordinates (higher eigenvalues are associated the to most significant coordinates) More...
 
std::vector< double > GetEigenvalues () const
 Returns the eigenvalues (sorted from highest to lowest) More...
 
size_t EstimateClusterNumber (double limit=1.0) const
 Estimates the number of clusters. More...
 
std::vector< std::vector
< double > > 
ProjectData (size_t ncoordinates, bool normalize) const
 Projects the data on the first coordinates. More...
 

Static Public Member Functions

static SpectralClustering CreateLocalScaleFromNN (const SquareMatrixDouble &distance_matrix, size_t sigma_neighborhood=7, double epsilon=std::numeric_limits< double >::max())
 Clustering with local automatic scale. More...
 
static SpectralClustering CreateGlobalScaleFromDimension (const SquareMatrixDouble &distance_matrix, size_t dimension, double epsilon=std::numeric_limits< double >::max())
 Clustering with global automatic scale. More...
 
static SpectralClustering CreateGlobalScaleFromNN (const SquareMatrixDouble &distance_matrix, size_t sigma_neighborhood=1, double epsilon=std::numeric_limits< double >::max())
 Clustering with global automatic scale. More...
 
static SpectralClustering CreateFixedScale (const SquareMatrixDouble &distance_matrix, double sigma, double epsilon=std::numeric_limits< double >::max())
 Clustering with global fixed scale. More...
 

Detailed Description

Spectral clustering.

Spectral clustering using Ng, Jordan & Weiss formula

Author
Yann LEYDIER
Date
September 2012
Version
0.1

Definition at line 49 of file CRNSpectralClustering.h.

Constructor & Destructor Documentation

crn::SpectralClustering::SpectralClustering ( const SpectralClustering )
delete
crn::SpectralClustering::SpectralClustering ( SpectralClustering &&  )
default

Member Function Documentation

SpectralClustering SpectralClustering::CreateFixedScale ( const SquareMatrixDouble distance_matrix,
double  sigma,
double  epsilon = std::numeric_limits<double>::max() 
)
static

Clustering with global fixed scale.

Clustering with local scale

Exceptions
ExceptionInvalidArgumentsigma < 0
ExceptionDimensionempty distance matrix
ExceptionRuntimetoo many iterations
Parameters
[in]distance_matrixthe distance matrix of the data
[in]sigmathe scale for Gaussian smoothing of the distance matrix
[in]epsilonthe maximal distance between two elements (if distance > epsilon, then the elements cannot be in the same class)

Definition at line 146 of file CRNSpectralClustering.cpp.

SpectralClustering SpectralClustering::CreateGlobalScaleFromDimension ( const SquareMatrixDouble distance_matrix,
size_t  dimension,
double  epsilon = std::numeric_limits<double>::max() 
)
static

Clustering with global automatic scale.

Clustering with global auto scale

Exceptions
ExceptionInvalidArgumentdimension <= 1
ExceptionDimensionempty distance matrix
ExceptionRuntimetoo many iterations
Parameters
[in]distance_matrixthe distance matrix of the data
[in]dimensionthe dimension of the original data
[in]epsilonthe maximal distance between two elements (if distance > epsilon, then the elements cannot be in the same class)

Definition at line 119 of file CRNSpectralClustering.cpp.

SpectralClustering SpectralClustering::CreateGlobalScaleFromNN ( const SquareMatrixDouble distance_matrix,
size_t  sigma_neighborhood = 1,
double  epsilon = std::numeric_limits<double>::max() 
)
static

Clustering with global automatic scale.

Clustering with global auto scale

Exceptions
ExceptionInvalidArgumentneighborhood <= 1
ExceptionDimensionempty distance matrix
ExceptionRuntimetoo many iterations
Parameters
[in]distance_matrixthe distance matrix of the data
[in]sigma_neighborhoodthe number of neighbors used to compute the local sigma
[in]epsilonthe maximal distance between two elements (if distance > epsilon, then the elements cannot be in the same class)

Definition at line 84 of file CRNSpectralClustering.cpp.

SpectralClustering SpectralClustering::CreateLocalScaleFromNN ( const SquareMatrixDouble distance_matrix,
size_t  sigma_neighborhood = 7,
double  epsilon = std::numeric_limits<double>::max() 
)
static

Clustering with local automatic scale.

Clustering with local auto scale

Exceptions
ExceptionInvalidArgumentneighborhood <= 1
ExceptionDimensionempty distance matrix
ExceptionRuntimetoo many iterations
Parameters
[in]distance_matrixthe distance matrix of the data
[in]sigma_neighborhoodthe number of neighbors used to compute the local sigma
[in]epsilonthe maximal distance between two elements (if distance > epsilon, then the elements cannot be in the same class)

Definition at line 42 of file CRNSpectralClustering.cpp.

size_t SpectralClustering::EstimateClusterNumber ( double  limit = 1.0) const

Estimates the number of clusters.

Estimates the number of clusters

Exceptions
ExceptionDomainlimit is <0 or >1
Parameters
[in]limitthe minimal eigenvalue to select. Normally it should be 1.0, but computational errors can make it necessary to use 0.9 for example.
Returns
the number of classes and optimal dimension of the projected data

Definition at line 206 of file CRNSpectralClustering.cpp.

const std::multimap<double, MatrixDouble>& crn::SpectralClustering::GetEigenpairs ( ) const
inlinenoexcept

Gets the data projected on each coordinates (higher eigenvalues are associated the to most significant coordinates)

Definition at line 67 of file CRNSpectralClustering.h.

std::vector< double > SpectralClustering::GetEigenvalues ( ) const

Returns the eigenvalues (sorted from highest to lowest)

Returns the eigenvalues (sorted from highest to lowest)

Returns
the eigenvalues sorted from highest to lowest

Definition at line 192 of file CRNSpectralClustering.cpp.

SpectralClustering& crn::SpectralClustering::operator= ( const SpectralClustering )
delete
SpectralClustering& crn::SpectralClustering::operator= ( SpectralClustering &&  )
default
std::vector< std::vector< double > > SpectralClustering::ProjectData ( size_t  ncoordinates,
bool  normalize 
) const

Projects the data on the first coordinates.

Projects the data on the first coordinates

Exceptions
ExceptionDimensionncoordinates < 1
Parameters
[in]ncoordinatesthe dimension of the projection space
[in]normalizeshall the elements be normalized on the unit circle?
Returns
a vector of projected elements

Definition at line 226 of file CRNSpectralClustering.cpp.


The documentation for this class was generated from the following files: