|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.misc.monotone.DiscreteDistribution
public class DiscreteDistribution
This class represents a discrete probability distribution over a finite number of values.
In the present implementation, objects of type
DiscreteDistribution
are in fact immutable,
so all one can do is create objects and retrieve information,
such as median and mean, from them.
This implementation is part of the master's thesis: "Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken", Stijn Lievens, Ghent University, 2004.
Constructor Summary | |
---|---|
DiscreteDistribution(CumulativeDiscreteDistribution cdf)
Create a DiscreteDistribution based on a
CumulativeDiscreteDistribution. |
|
DiscreteDistribution(DiscreteEstimator e)
Create a DiscreteDistribution based on a
DiscreteEstimator. |
|
DiscreteDistribution(double[] dd)
Create a DiscreteDistribution based on an
array of doubles. |
Method Summary | |
---|---|
int |
getNumSymbols()
Get the number of elements over which the
DiscreteDistribution is defined. |
double |
getProbability(int index)
Get the probability of finding the element at a specified index. |
java.lang.String |
getRevision()
Returns the revision string. |
double |
mean()
Calculate the mean of the distribution. |
double |
median()
Calculate the median of the distribution. |
int[] |
modes()
Get a sorted array containing the indices of the elements with maximal probability. |
boolean |
stochasticDominatedBy(DiscreteDistribution dd)
Checks if this is dominated by dd. |
double[] |
toArray()
Convert the DiscreteDistribution to an
array of doubles. |
java.lang.String |
toString()
Get a string representation of the given
DiscreteDistribution. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DiscreteDistribution(DiscreteEstimator e)
DiscreteDistribution
based on a
DiscreteEstimator.
e
- the DiscreteEstimator
public DiscreteDistribution(CumulativeDiscreteDistribution cdf)
DiscreteDistribution
based on a
CumulativeDiscreteDistribution.
cdf
- the CumulativeDiscreteDistribution
public DiscreteDistribution(double[] dd) throws java.lang.IllegalArgumentException
DiscreteDistribution
based on an
array of doubles.
dd
- the array of doubles representing a valid
discrete distribution
java.lang.IllegalArgumentException
- if dd
does not represent a valid discrete distributionMethod Detail |
---|
public int getNumSymbols()
DiscreteDistribution
is defined.
DiscreteDistribution
is definedpublic double getProbability(int index)
index
- the index of the required element
public double mean()
public double median()
public int[] modes()
public double[] toArray()
DiscreteDistribution
to an
array of doubles.
DiscreteDistribution
public java.lang.String toString()
DiscreteDistribution.
toString
in class java.lang.Object
public boolean stochasticDominatedBy(DiscreteDistribution dd) throws java.lang.IllegalArgumentException
this
is dominated by dd.
dd
- the DiscreteDistribution to compare to
true
if this
is dominated by
dd
, false
otherwise
java.lang.IllegalArgumentException
- if the two distributions don't
have the same lengthpublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |