Package weka.clusterers

# Interface Clusterer

All Known Subinterfaces:
  `DensityBasedClusterer`

All Known Implementing Classes:
  `AbstractClusterer`, `AbstractDensityBasedClusterer`, `Canopy`, `Cobweb`, `EM`, `FarthestFirst`, `FilteredClusterer`, `HierarchicalClusterer`, `MakeDensityBasedClusterer`, `RandomizableClusterer`, `RandomizableDensityBasedClusterer`, `RandomizableSingleClustererEnhancer`, `SimpleKMeans`, `SingleClustererEnhancer`

public interface Clusterer
Interface for clusterers. Clients will typically extend either AbstractClusterer or AbstractDensityBasedClusterer.

Version:
  $Revision: 8034 $
Author:
  Mark Hall (mhall@cs.waikato.ac.nz)

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `buildClusterer(Instances data)`
  Generates a clusterer.
  `int`
  `clusterInstance(Instance instance)`
  Classifies a given instance.
  `double[]`
  `distributionForInstance(Instance instance)`
  Predicts the cluster memberships for a given instance.
  `Capabilities`
  `getCapabilities()`
  Returns the Capabilities of this clusterer.
  `int`
  `numberOfClusters()`
  Returns the number of clusters.

- ## Method Details

  - ### buildClusterer

    void buildClusterer(Instances data) throws Exception
    Generates a clusterer. Has to initialize all fields of the clusterer that are not being set via options.
    Parameters:
      `data` - set of instances serving as training data
    Throws:
      `Exception` - if the clusterer has not been generated successfully

  - ### clusterInstance

    int clusterInstance(Instance instance) throws Exception
    Classifies a given instance. Either this or distributionForInstance() needs to be implemented by subclasses.
    Parameters:
      `instance` - the instance to be assigned to a cluster
    Returns:
      the number of the assigned cluster as an integer
    Throws:
      `Exception` - if instance could not be clustered successfully

  - ### distributionForInstance

    double[] distributionForInstance(Instance instance) throws Exception
    Predicts the cluster memberships for a given instance. Either this or clusterInstance() needs to be implemented by subclasses.
    Parameters:
      `instance` - the instance to be assigned a cluster.
    Returns:
      an array containing the estimated membership probabilities of the test instance in each cluster (this should sum to at most 1)
    Throws:
      `Exception` - if distribution could not be computed successfully

  - ### numberOfClusters

    int numberOfClusters() throws Exception
    Returns the number of clusters.
    Returns:
      the number of clusters generated for a training dataset.
    Throws:
      `Exception` - if number of clusters could not be returned successfully

  - ### getCapabilities

    Capabilities getCapabilities()
    Returns the Capabilities of this clusterer. Derived classifiers have to override this method to enable capabilities.
    Returns:
      the capabilities of this object
    See Also:
      - `Capabilities`