Package weka.clusterers
Class AbstractDensityBasedClusterer
java.lang.Object
weka.clusterers.AbstractClusterer
weka.clusterers.AbstractDensityBasedClusterer
- All Implemented Interfaces:
Serializable
,Cloneable
,Clusterer
,DensityBasedClusterer
,CapabilitiesHandler
,CapabilitiesIgnorer
,CommandlineRunnable
,OptionHandler
,RevisionHandler
- Direct Known Subclasses:
MakeDensityBasedClusterer
,RandomizableDensityBasedClusterer
public abstract class AbstractDensityBasedClusterer
extends AbstractClusterer
implements DensityBasedClusterer
Abstract clustering model that produces (for each test instance)
an estimate of the membership in each cluster
(ie. a probability distribution).
- Version:
- $Revision: 8034 $
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract double[]
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.double[]
Returns the logs of the joint densities for a given instance.static DensityBasedClusterer[]
makeCopies
(DensityBasedClusterer model, int num) Creates copies of the current clusterer.Methods inherited from class weka.clusterers.AbstractClusterer
buildClusterer, clusterInstance, debugTipText, doNotCheckCapabilitiesTipText, forName, getCapabilities, getDebug, getDoNotCheckCapabilities, getOptions, getRevision, listOptions, makeCopies, makeCopy, numberOfClusters, postExecution, preExecution, run, runClusterer, setDebug, setDoNotCheckCapabilities, setOptions
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface weka.clusterers.Clusterer
buildClusterer, clusterInstance, getCapabilities, numberOfClusters
-
Constructor Details
-
AbstractDensityBasedClusterer
public AbstractDensityBasedClusterer()
-
-
Method Details
-
clusterPriors
Returns the prior probability of each cluster.- Specified by:
clusterPriors
in interfaceDensityBasedClusterer
- Returns:
- the prior probability for each cluster
- Throws:
Exception
- if priors could not be returned successfully
-
logDensityPerClusterForInstance
Computes the log of the conditional density (per cluster) for a given instance.- Specified by:
logDensityPerClusterForInstance
in interfaceDensityBasedClusterer
- Parameters:
instance
- the instance to compute the density for- Returns:
- an array containing the estimated densities
- Throws:
Exception
- if the density could not be computed successfully
-
logDensityForInstance
Computes the density for a given instance.- Specified by:
logDensityForInstance
in interfaceDensityBasedClusterer
- Parameters:
instance
- the instance to compute the density for- Returns:
- the density.
- Throws:
Exception
- if the density could not be computed successfully
-
distributionForInstance
Returns the cluster probability distribution for an instance.- Specified by:
distributionForInstance
in interfaceClusterer
- Specified by:
distributionForInstance
in interfaceDensityBasedClusterer
- Overrides:
distributionForInstance
in classAbstractClusterer
- Parameters:
instance
- the instance to be clustered- Returns:
- the probability distribution
- Throws:
Exception
- if computation fails
-
logJointDensitiesForInstance
Returns the logs of the joint densities for a given instance.- Specified by:
logJointDensitiesForInstance
in interfaceDensityBasedClusterer
- Parameters:
inst
- the instance- Returns:
- the array of values
- Throws:
Exception
- if values could not be computed
-
makeCopies
public static DensityBasedClusterer[] makeCopies(DensityBasedClusterer model, int num) throws 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 copynum
- the number of clusterer copies to create.- Returns:
- an array of clusterers.
- Throws:
Exception
- if an error occurs
-