|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.clusterers.Clusterer
weka.clusterers.DensityBasedClusterer
weka.clusterers.MakeDensityBasedClusterer
Class for wrapping a Clusterer to make it return a distribution and density. Fits normal distributions and discrete distributions within each cluster produced by the wrapped clusterer.
Field Summary | |
private double |
m_minStdDev
default minimum standard deviation |
private DiscreteEstimator[][] |
m_model
discrete distributions fitted to each discrete attribute in each cluster |
private double[][][] |
m_modelNormal
normal distributions fitted to each numeric attribute in each cluster |
private static double |
m_normConst
Constant for normal distribution. |
private double[] |
m_priors
prior probabilities for the fitted clusters |
private Instances |
m_theInstances
holds training instances header information |
private Clusterer |
m_wrappedClusterer
The clusterer being wrapped |
Constructor Summary | |
MakeDensityBasedClusterer()
Default constructor. |
|
MakeDensityBasedClusterer(Clusterer toWrap)
Contructs a MakeDensityBasedClusterer wrapping a given Clusterer. |
Method Summary | |
void |
buildClusterer(Instances data)
Builds a clusterer for a set of instances. |
double[] |
clusterPriors()
Returns the cluster priors. |
Clusterer |
getClusterer()
Gets the clusterer being wrapped. |
double |
getMinStdDev()
Get the minimum allowable standard deviation. |
java.lang.String[] |
getOptions()
Gets the current settings of the clusterer. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.. |
double[] |
logDensityPerClusterForInstance(Instance inst)
Computes the log of the conditional density (per cluster) for a given instance. |
private double |
logNormalDens(double x,
double mean,
double stdDev)
Density function of normal distribution. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
java.lang.String |
minStdDevTipText()
Returns the tip text for this property |
int |
numberOfClusters()
Returns the number of clusters. |
void |
setClusterer(Clusterer toWrap)
Sets the clusterer to wrap. |
void |
setMinStdDev(double m)
Set the minimum value for standard deviation when calculating normal density. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString()
Returns a description of the clusterer. |
Methods inherited from class weka.clusterers.DensityBasedClusterer |
distributionForInstance, logDensityForInstance, logJointDensitiesForInstance |
Methods inherited from class weka.clusterers.Clusterer |
clusterInstance, forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private Instances m_theInstances
private double[] m_priors
private double[][][] m_modelNormal
private DiscreteEstimator[][] m_model
private double m_minStdDev
private Clusterer m_wrappedClusterer
private static double m_normConst
Constructor Detail |
public MakeDensityBasedClusterer()
public MakeDensityBasedClusterer(Clusterer toWrap)
toWrap
- the clusterer to wrap aroundMethod Detail |
public void buildClusterer(Instances data) throws java.lang.Exception
buildClusterer
in class Clusterer
data
- set of instances serving as training data
java.lang.Exception
- if the clusterer hasn't been set or something goes wrongpublic double[] clusterPriors()
clusterPriors
in class DensityBasedClusterer
public double[] logDensityPerClusterForInstance(Instance inst) throws java.lang.Exception
logDensityPerClusterForInstance
in class DensityBasedClusterer
inst
- the instance to compute the density for
java.lang.Exception
- if the density could not be computed
successfullyprivate double logNormalDens(double x, double mean, double stdDev)
x
- input valuemean
- mean of distributionstdDev
- standard deviation of distributionpublic int numberOfClusters() throws java.lang.Exception
numberOfClusters
in class Clusterer
java.lang.Exception
- if number of clusters could not be returned successfullypublic java.lang.String toString()
public void setClusterer(Clusterer toWrap)
toWrap
- the clustererpublic Clusterer getClusterer()
public java.lang.String minStdDevTipText()
public void setMinStdDev(double m)
m
- minimum value for standard deviationpublic double getMinStdDev()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-W clusterer name
Clusterer to wrap. (required)
-M
Set the minimum allowable standard deviation for normal density
calculation.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supported
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public static void main(java.lang.String[] argv)
argv
- the options
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |