weka.clusterers
Class DensityBasedClusterer

java.lang.Object
  extended byweka.clusterers.Clusterer
      extended byweka.clusterers.DensityBasedClusterer
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
EM, MakeDensityBasedClusterer

public abstract class DensityBasedClusterer
extends Clusterer

Abstract clustering model that produces (for each test instance) an estimate of the membership in each cluster (ie. a probability distribution).

Version:
$Revision: 1.1 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
DensityBasedClusterer()
           
 
Method Summary
abstract  double[] clusterPriors()
          Returns the prior probability of each cluster.
 double[] distributionForInstance(Instance instance)
          Returns the cluster probability distribution for an instance.
 double logDensityForInstance(Instance instance)
          Computes the density for a given instance.
abstract  double[] logDensityPerClusterForInstance(Instance instance)
          Computes the log of the conditional density (per cluster) for a given instance.
protected  double[] logJointDensitiesForInstance(Instance inst)
          Returns the logs of the joint densities for a given instance.
 
Methods inherited from class weka.clusterers.Clusterer
buildClusterer, clusterInstance, forName, makeCopies, numberOfClusters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DensityBasedClusterer

public DensityBasedClusterer()
Method Detail

clusterPriors

public abstract double[] clusterPriors()
                                throws java.lang.Exception
Returns the prior probability of each cluster.

Returns:
the prior probability for each cluster
Throws:
java.lang.Exception - if priors could not be returned successfully

logDensityPerClusterForInstance

public abstract double[] logDensityPerClusterForInstance(Instance instance)
                                                  throws java.lang.Exception
Computes the log of the conditional density (per cluster) for a given instance.

Parameters:
instance - the instance to compute the density for
Returns:
the density.
Throws:
java.lang.Exception - if the density could not be computed successfully

logDensityForInstance

public double logDensityForInstance(Instance instance)
                             throws java.lang.Exception
Computes the density for a given instance.

Parameters:
instance - the instance to compute the density for
Returns:
the density.
Throws:
java.lang.Exception - if the density could not be computed successfully

distributionForInstance

public double[] distributionForInstance(Instance instance)
                                 throws java.lang.Exception
Returns the cluster probability distribution for an instance. Will simply have a probability of 1 for the chosen cluster and 0 for the others.

Overrides:
distributionForInstance in class Clusterer
Parameters:
instance - the instance to be clustered
Returns:
the probability distribution
Throws:
java.lang.Exception - if distribution could not be computed successfully

logJointDensitiesForInstance

protected double[] logJointDensitiesForInstance(Instance inst)
                                         throws java.lang.Exception
Returns the logs of the joint densities for a given instance.

Parameters:
inst - the instance
Returns:
the array of values
Throws:
java.lang.Exception - if values could not be computed