Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.clusterers
Class Clusterer

    java.lang.Object
      weka.clusterers.Clusterer

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

Direct Known Subclasses:
  Cobweb, DensityBasedClusterer, FarthestFirst, SimpleKMeans

    public abstract class Clusterer

extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Abstract clusterer.

Version:
  $Revision: 1.10 $
Author:
  Mark Hall (mhall@cs.waikato.ac.nz)
See Also:
  Serialized Form

Constructor Summary
`Clusterer()`

Method Summary
`abstract 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.
`static Clusterer` | `forName(java.lang.String clustererName, java.lang.String[] options)` Creates a new instance of a clusterer given it's class name and (optional) arguments to pass to it's setOptions method.
`static Clusterer[]` | `makeCopies(Clusterer model, int num)` Creates copies of the current clusterer.
`abstract int` | `numberOfClusters()` Returns the number of clusters.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Clusterer

    public Clusterer()

Method Detail

### buildClusterer

    public abstract void buildClusterer(Instances data)
                                 throws java.lang.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:
    `java.lang.Exception` - if the clusterer has not been generated successfully

### clusterInstance

    public int clusterInstance(Instance instance)
                        throws java.lang.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:
    `java.lang.Exception` - if instance could not be clustered successfully

### distributionForInstance

    public double[] distributionForInstance(Instance instance)
                                     throws java.lang.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:
    `java.lang.Exception` - if distribution could not be computed successfully

### numberOfClusters

    public abstract int numberOfClusters()
                                  throws java.lang.Exception

  Returns the number of clusters.

  Returns:
    the number of clusters generated for a training dataset.
  Throws:
    `java.lang.Exception` - if number of clusters could not be returned successfully

### forName

    public static Clusterer forName(java.lang.String clustererName,
                                    java.lang.String[] options)
                             throws java.lang.Exception

  Creates a new instance of a clusterer given it's class name and (optional) arguments to pass to it's setOptions method. If the clusterer implements OptionHandler and the options parameter is non-null, the clusterer will have it's options set.

  Parameters:
    `searchName` - the fully qualified class name of the clusterer
    `options` - an array of options suitable for passing to setOptions. May be null.
  Returns:
    the newly created search object, ready for use.
  Throws:
    `java.lang.Exception` - if the clusterer class name is invalid, or the options supplied are not acceptable to the clusterer.

### makeCopies

    public static Clusterer[] makeCopies(Clusterer model,
                                         int num)
                                  throws java.lang.Exception

  Creates copies of the current clusterer. Note that this method now uses Serialization to perform a deep copy, so the Clusterer object must be fully Serializable. Any currently built model will now be copied as well.

  Parameters:
    `model` - an example clusterer to copy
    `num` - the number of clusterer copies to create.
  Returns:
    an array of clusterers.
  Throws:
    `java.lang.Exception` - if an error occurs

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD