spectral-clustering-0.3.0.4: Library for spectral clustering.

Safe HaskellNone
LanguageHaskell2010

Math.Clustering.Spectral.Dense

Synopsis

Documentation

spectralClusterKNorm :: Int -> Int -> AdjacencyMatrix -> LabelVector Source #

Returns the clustering of eigenvectors with the second smallest eigenvalues and on of the symmetric normalized Laplacian L. Computes real symmetric part of L, so ensure the input is real and symmetric. Diagonal should be 0s for adjacency matrix. Clusters the eigenvector using kmeans into k groups from e eigenvectors.

spectralClusterNorm :: AdjacencyMatrix -> LabelVector Source #

Returns the eigenvector with the second smallest eigenvalue of the symmetric normalized Laplacian L. Computes real symmetric part of L, so ensure the input is real and symmetric. Diagonal should be 0s for adjacency matrix.

spectralNorm :: Int -> Int -> AdjacencyMatrix -> [Vector Double] Source #

Returns the eigenvectors with the Nth smallest eigenvalue and on of the symmetric normalized Laplacian L. Computes real symmetric part of L, so ensure the input is real and symmetric. Diagonal should be 0s for adjacency matrix.

getDegreeMatrix :: AdjacencyMatrix -> Diag Source #

Obtain the signed degree matrix.

type AdjacencyMatrix = Matrix Double Source #

Adjacency matrix input.

type LabelVector = Vector Double Source #

Output vector containing cluster assignment (0 or 1).

newtype B Source #

Normed rows of B2. For a complete explanation, see Shu et al., "Efficient Spectral Neighborhood Blocking for Entity Resolution", 2011.

Constructors

B 

Fields

Instances
Show B Source # 
Instance details

Defined in Math.Clustering.Spectral.Dense

Methods

showsPrec :: Int -> B -> ShowS #

show :: B -> String #

showList :: [B] -> ShowS #

newtype B1 Source #

B1 observation by feature matrix.

Constructors

B1 

Fields

Instances
Show B1 Source # 
Instance details

Defined in Math.Clustering.Spectral.Dense

Methods

showsPrec :: Int -> B1 -> ShowS #

show :: B1 -> String #

showList :: [B1] -> ShowS #

newtype B2 Source #

B2 term frequency-inverse document frequency matrix of B1.

Constructors

B2 

Fields

Instances
Show B2 Source # 
Instance details

Defined in Math.Clustering.Spectral.Dense

Methods

showsPrec :: Int -> B2 -> ShowS #

show :: B2 -> String #

showList :: [B2] -> ShowS #

spectral :: Int -> Int -> B -> [Vector Double] Source #

Returns the second left singular vector (or from N) and E on of a sparse spectral process. Assumes the columns are features and rows are observations. B is the normalized matrix (from getB). See Shu et al., "Efficient Spectral Neighborhood Blocking for Entity Resolution", 2011.

spectralCluster :: B -> LabelVector Source #

Returns a vector of cluster labels for two groups by finding the second left singular vector of a special normalized matrix. Assumes the columns are features and rows are observations. B is the normalized matrix (from getB). See Shu et al., "Efficient Spectral Neighborhood Blocking for Entity Resolution", 2011.

spectralClusterK :: Int -> Int -> B -> LabelVector Source #

Returns a vector of cluster labels for two groups by finding the second left singular vector and on of a special normalized matrix and running kmeans. Assumes the columns are features and rows are observations. B is the normalized matrix (from getB). See Shu et al., "Efficient Spectral Neighborhood Blocking for Entity Resolution", 2011.

getB :: Bool -> Matrix Double -> B Source #

Get the normalized matrix B from an input matrix where the features are columns and rows are observations. Optionally, do not normalize.

b1ToB2 :: B1 -> B2 Source #

Normalize the input matrix by column. Here, columns are features.

getSimilarityFromB2 :: B2 -> Int -> Int -> Double Source #

Get the cosine similarity between two rows using B2.