class HierClusterer extends Clusterer with Error

Cluster several vectors/points using hierarchical clustering. Start with each point forming its own cluster and merge clusters until there are only 'k'.

Linear Supertypes
Error, Clusterer, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HierClusterer
  2. Error
  3. Clusterer
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new HierClusterer(x: MatriD, k: Int = 2)

    x

    the vectors/points to be clustered stored as rows of a matrix

    k

    stop when the number of clusters equals k

Value Members

  1. def calcCentroids(x: MatriD, to_c: Array[Int], sz: VectoI, cent: MatriD): Unit

    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.

    x

    the data matrix holding the points {x_i = x(i)} in its rows

    to_c

    the cluster assignment array

    sz

    the sizes of the clusters (number of points)

    cent

    the matrix holding the centroids in its rows

    Definition Classes
    Clusterer
  2. def centroids: MatriD

    Return the centroids.

    Return the centroids. Should only be called after train.

    Definition Classes
    HierClustererClusterer
  3. def checkOpt(x: MatriD, to_c: Array[Int], opt: Double): Boolean

    Check to see if the sum of squared errors is optimum.

    Check to see if the sum of squared errors is optimum.

    x

    the data matrix holding the points

    to_c

    the cluster assignments

    opt

    the known (from human/oracle) optimum

    Definition Classes
    Clusterer
  4. def classify(z: VectoD): Int

    Given a new point/vector y, determine which cluster it belongs to.

    Given a new point/vector y, determine which cluster it belongs to.

    z

    the vector to classify

    Definition Classes
    HierClustererClusterer
  5. def cluster: Array[Int]

    Return the cluster assignment vector.

    Return the cluster assignment vector. Should only be called after train.

    Definition Classes
    HierClustererClusterer
  6. def csize: VectoI

    Return the sizes of the centroids.

    Return the sizes of the centroids. Should only be called after train.

    Definition Classes
    HierClustererClusterer
  7. def distance(u: VectoD, cn: MatriD, kc_: Int = -1): VectoD

    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'

    u

    the given vector/point (u = x_i)

    cn

    the matrix holding several centroids

    kc_

    the number of centroids so far

    Definition Classes
    Clusterer
  8. final def flaw(method: String, message: String): Unit
    Definition Classes
    Error
  9. def initCentroids(): Boolean
    Definition Classes
    Clusterer
  10. def name(c: Int): String

    Return the name of the 'c'-th cluster.

    Return the name of the 'c'-th cluster.

    c

    the c-th cluster

    Definition Classes
    Clusterer
  11. def name_(nm: Strings): Unit

    Set the names for the clusters.

    Set the names for the clusters.

    nm

    the array of names

    Definition Classes
    Clusterer
  12. def setStream(s: Int): Unit

    Set the random stream to 's'.

    Set the random stream to 's'. Method must be called in implemeting classes before creating any random generators.

    s

    the new value for the random number stream

    Definition Classes
    Clusterer
  13. def sse(x: MatriD, c: Int, to_c: Array[Int]): Double

    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.

    x

    the data matrix holding the points

    c

    the current cluster

    to_c

    the cluster assignments

    Definition Classes
    Clusterer
  14. def sse(x: MatriD, to_c: Array[Int]): Double

    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.

    x

    the data matrix holding the points

    to_c

    the cluster assignments

    Definition Classes
    Clusterer
  15. def sst(x: MatriD): Double

    Compute the sum of squares total for all the points from the mean.

    Compute the sum of squares total for all the points from the mean.

    x

    the data matrix holding the points

    Definition Classes
    Clusterer
  16. def train(): HierClusterer

    Iteratively merge clusters until the number of clusters equals 'k'.

    Iteratively merge clusters until the number of clusters equals 'k'.

    Definition Classes
    HierClustererClusterer