MarkovClusterer
The MarkovClusterer
class implements a Markov Clustering Algorithm 'MCL' and is used to cluster nodes in a graph. The graph is represented as an edge-weighted adjacency matrix (a non-zero cell indicates nodes i and j are connected). The primary constructor takes either a graph (adjacency matrix) or a Markov transition matrix as input. If a graph is passed in, the normalize method must be called to convert it into a Markov transition matrix. Before normalizing, it may be helpful to add self loops to the graph. The matrix (graph or transition) may be either dense or sparse. See the MarkovClustererTest
object at the bottom of the file for examples.
Value parameters
- k
-
the strength of expansion
- r
-
the strength of inflation
- t
-
either an adjacency matrix of a graph or a Markov transition matrix
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Add self-loops by setting the main diagonal to the weight parameter.
Add self-loops by setting the main diagonal to the weight parameter.
Value parameters
- weight
-
the edge weight on self-loops to be added.
Attributes
Return the centroids. Should only be called after 'train'.
Return the centroids. Should only be called after 'train'.
Attributes
This clustering method is not applicable to graph clustering.
This clustering method is not applicable to graph clustering.
Value parameters
- y
-
unused parameter
Attributes
Return the cluster assignment vector. Should only be called after train
.
Return the cluster assignment vector. Should only be called after train
.
Attributes
Return the sizes of the centroids. Should only be called after 'train'.
Return the sizes of the centroids. Should only be called after 'train'.
Attributes
Normalize the matrix t so that each column sums to 1, i.e., convert the adjacency matrix of a graph into a Markov transition matrix.
Normalize the matrix t so that each column sums to 1, i.e., convert the adjacency matrix of a graph into a Markov transition matrix.
Attributes
Return the processed matrix t. The matrix is processed by repeated steps of expansion and inflation until convergence is detected.
Return the processed matrix t. The matrix is processed by repeated steps of expansion and inflation until convergence is detected.
Attributes
Cluster the nodes in the graph by interpreting the processed matrix t. Nodes not clustered will be in group 0; otherwise, they will be grouped with their strongest positive attractor.
Cluster the nodes in the graph by interpreting the processed matrix t. Nodes not clustered will be in group 0; otherwise, they will be grouped with their strongest positive attractor.
Attributes
Inherited methods
Calculate the centroids based on current assignment of points to clusters and update the 'cent' matrix that stores the centroids in its rows.
Calculate the centroids based on current assignment of points to clusters and update the 'cent' matrix that stores the centroids in its rows.
Value parameters
- cent
-
the matrix holding the centroids in its rows
- sz
-
the sizes of the clusters (number of points)
- to_c
-
the cluster assignment array
- x
-
the data matrix holding the points {x_i = x(i)} in its rows
Attributes
- Inherited from:
- Clusterer
Check to see if the sum of squared errors is optimum.
Check to see if the sum of squared errors is optimum.
Value parameters
- opt
-
the known (from human/oracle) optimum
- to_c
-
the cluster assignments
- x
-
the data matrix holding the points
Attributes
- Inherited from:
- Clusterer
Compute the distances between vector/point 'u' and the points stored as rows in matrix 'cn'
Compute the distances between vector/point 'u' and the points stored as rows in matrix 'cn'
Value parameters
- cn
-
the matrix holding several centroids
- kc_
-
the number of centroids so far
- u
-
the given vector/point (u = x_i)
Attributes
- Inherited from:
- Clusterer
Return whether the centroids have been initialized.
Return the name of the 'c'-th cluster.
Return the name of the 'c'-th cluster.
Value parameters
- c
-
the c-th cluster
Attributes
- Inherited from:
- Clusterer
Set the names for the clusters.
Set the names for the clusters.
Value parameters
- nm
-
the array of names
Attributes
- Inherited from:
- Clusterer
Set the random stream to 's'. Method must be called in implemeting classes before creating any random generators.
Set the random stream to 's'. Method must be called in implemeting classes before creating any random generators.
Value parameters
- s
-
the new value for the random number stream
Attributes
- Inherited from:
- Clusterer
Compute the sum of squared errors from the points in cluster 'c' to the cluster's centroid.
Compute the sum of squared errors from the points in cluster 'c' to the cluster's centroid.
Value parameters
- c
-
the current cluster
- to_c
-
the cluster assignments
- x
-
the data matrix holding the points
Attributes
- Inherited from:
- Clusterer
Compute the sum of squared errors within all clusters, where error is indicated by e.g., the distance from a point to its centroid.
Compute the sum of squared errors within all clusters, where error is indicated by e.g., the distance from a point to its centroid.
Value parameters
- to_c
-
the cluster assignments
- x
-
the data matrix holding the points
Attributes
- Inherited from:
- Clusterer