AbstractDensityBasedClusterer (original) (raw)
java.lang.Object
- weka.clusterers.AbstractClusterer
- weka.clusterers.AbstractDensityBasedClusterer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Clusterer, DensityBasedClusterer, CapabilitiesHandler, 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:1.1Revision: 1.1 Revision:1.1
Author:
Mark Hall (mhall@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
Serialized Form
Constructor Summary
Constructors
Constructor and Description AbstractDensityBasedClusterer() Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
Modifier and Type Method and Description 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. double[] logJointDensitiesForInstance(Instance inst) 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](../../weka/clusterers/AbstractClusterer.html "class in weka.clusterers") `[buildClusterer](../../weka/clusterers/AbstractClusterer.html#buildClusterer-weka.core.Instances-), [clusterInstance](../../weka/clusterers/AbstractClusterer.html#clusterInstance-weka.core.Instance-), [forName](../../weka/clusterers/AbstractClusterer.html#forName-java.lang.String-java.lang.String:A-), [getCapabilities](../../weka/clusterers/AbstractClusterer.html#getCapabilities--), [getRevision](../../weka/clusterers/AbstractClusterer.html#getRevision--), [makeCopies](../../weka/clusterers/AbstractClusterer.html#makeCopies-weka.clusterers.Clusterer-int-), [makeCopy](../../weka/clusterers/AbstractClusterer.html#makeCopy-weka.clusterers.Clusterer-), [numberOfClusters](../../weka/clusterers/AbstractClusterer.html#numberOfClusters--)` * ### Methods inherited from class java.lang.Object `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait` * ### Methods inherited from interface weka.clusterers.[Clusterer](../../weka/clusterers/Clusterer.html "interface in weka.clusterers") `[buildClusterer](../../weka/clusterers/Clusterer.html#buildClusterer-weka.core.Instances-), [clusterInstance](../../weka/clusterers/Clusterer.html#clusterInstance-weka.core.Instance-), [getCapabilities](../../weka/clusterers/Clusterer.html#getCapabilities--), [numberOfClusters](../../weka/clusterers/Clusterer.html#numberOfClusters--)`
Constructor Detail
* #### AbstractDensityBasedClusterer public AbstractDensityBasedClusterer()
Method Detail
* #### clusterPriors public abstract double[] clusterPriors() throws java.lang.Exception Returns the prior probability of each cluster. Specified by: `[clusterPriors](../../weka/clusterers/DensityBasedClusterer.html#clusterPriors--)` in interface `[DensityBasedClusterer](../../weka/clusterers/DensityBasedClusterer.html "interface in weka.clusterers")` Returns: the prior probability for each cluster Throws: `java.lang.Exception` \- if priors could not be returned successfully * #### logDensityPerClusterForInstance public abstract double[] logDensityPerClusterForInstance([Instance](../../weka/core/Instance.html "class in weka.core") instance) throws java.lang.Exception Computes the log of the conditional density (per cluster) for a given instance. Specified by: `[logDensityPerClusterForInstance](../../weka/clusterers/DensityBasedClusterer.html#logDensityPerClusterForInstance-weka.core.Instance-)` in interface `[DensityBasedClusterer](../../weka/clusterers/DensityBasedClusterer.html "interface in weka.clusterers")` Parameters: `instance` \- the instance to compute the density for Returns: an array containing the estimated densities Throws: `java.lang.Exception` \- if the density could not be computed successfully * #### logDensityForInstance public double logDensityForInstance([Instance](../../weka/core/Instance.html "class in weka.core") instance) throws java.lang.Exception Computes the density for a given instance. Specified by: `[logDensityForInstance](../../weka/clusterers/DensityBasedClusterer.html#logDensityForInstance-weka.core.Instance-)` in interface `[DensityBasedClusterer](../../weka/clusterers/DensityBasedClusterer.html "interface in weka.clusterers")` 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](../../weka/core/Instance.html "class in weka.core") instance) throws java.lang.Exception Returns the cluster probability distribution for an instance. Specified by: `[distributionForInstance](../../weka/clusterers/Clusterer.html#distributionForInstance-weka.core.Instance-)` in interface `[Clusterer](../../weka/clusterers/Clusterer.html "interface in weka.clusterers")` Specified by: `[distributionForInstance](../../weka/clusterers/DensityBasedClusterer.html#distributionForInstance-weka.core.Instance-)` in interface `[DensityBasedClusterer](../../weka/clusterers/DensityBasedClusterer.html "interface in weka.clusterers")` Overrides: `[distributionForInstance](../../weka/clusterers/AbstractClusterer.html#distributionForInstance-weka.core.Instance-)` in class `[AbstractClusterer](../../weka/clusterers/AbstractClusterer.html "class in weka.clusterers")` Parameters: `instance` \- the instance to be clustered Returns: the probability distribution Throws: `java.lang.Exception` \- if computation fails * #### logJointDensitiesForInstance public double[] logJointDensitiesForInstance([Instance](../../weka/core/Instance.html "class in weka.core") inst) throws java.lang.Exception Returns the logs of the joint densities for a given instance. Specified by: `[logJointDensitiesForInstance](../../weka/clusterers/DensityBasedClusterer.html#logJointDensitiesForInstance-weka.core.Instance-)` in interface `[DensityBasedClusterer](../../weka/clusterers/DensityBasedClusterer.html "interface in weka.clusterers")` Parameters: `inst` \- the instance Returns: the array of values Throws: `java.lang.Exception` \- if values could not be computed * #### makeCopies public static [DensityBasedClusterer](../../weka/clusterers/DensityBasedClusterer.html "interface in weka.clusterers")[] makeCopies([DensityBasedClusterer](../../weka/clusterers/DensityBasedClusterer.html "interface in weka.clusterers") 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