|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.misc.monotone.CumulativeDiscreteDistribution
public class CumulativeDiscreteDistribution
Represents a discrete cumulative probability distribution over a totally ordered discrete set. The elements of this set are numbered consecutively starting from 0.
In this implementation object of type
CumulativeDiscreteDistribution
are immutable.
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 | |
---|---|
CumulativeDiscreteDistribution(DiscreteDistribution d)
Create a CumulativeDiscreteDistribution based on a
DiscreteDistribution. |
|
CumulativeDiscreteDistribution(DiscreteEstimator e)
Create a discrete cumulative probability distribution based on a DiscreteEstimator. |
|
CumulativeDiscreteDistribution(double[] cdf)
Create a CumulativeDiscreteDistribution based on an
array of doubles. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Indicates if the object o equals this. |
double |
getCumulativeProbability(int index)
Get the probability of finding an element smaller or equal than index. |
int |
getNumSymbols()
Get the number of elements over which the cumulative probability distribution is defined. |
java.lang.String |
getRevision()
Returns the revision string. |
boolean |
stochasticDominatedBy(CumulativeDiscreteDistribution cdf)
Returns if this is dominated by cdf. |
double[] |
toArray()
Get an array representation of the cumulative probability distribution. |
java.lang.String |
toString()
Get a string representation of the cumulative probability distribution. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CumulativeDiscreteDistribution(DiscreteEstimator e)
DiscreteEstimator.
e
- the DiscreteEstimator
on which the
cumulative probability distribution will be basedpublic CumulativeDiscreteDistribution(DiscreteDistribution d)
CumulativeDiscreteDistribution
based on a
DiscreteDistribution.
d
- the DiscreteDistribution
on which the
cumulative probability distribution will be basedpublic CumulativeDiscreteDistribution(double[] cdf) throws java.lang.IllegalArgumentException
CumulativeDiscreteDistribution
based on an
array of doubles. The array cdf
is copied, so
the caller can reuse the same array.
cdf
- an array that represents a valid discrete cumulative
probability distribution
java.lang.IllegalArgumentException
- if the array doesn't
represent a valid cumulative discrete distribution functionMethod Detail |
---|
public int getNumSymbols()
public double getCumulativeProbability(int index)
index.
index
- the required index
public double[] toArray()
public boolean stochasticDominatedBy(CumulativeDiscreteDistribution cdf) throws java.lang.IllegalArgumentException
this
is dominated by cdf.
This means that we check if, for all indices i
, it
holds that this.getProbability(i) >= cdf.getProbability(i).
cdf
- the CumulativeDiscreteDistribution
this
is compared to
true
if this
is dominated by
cdf
, false
otherwise
java.lang.IllegalArgumentException
- if the two distributions don't
have the same lengthpublic boolean equals(java.lang.Object o)
o
equals this.
Note: for practical reasons I was forced to use a small tolerance
whilst comparing the distributions, meaning that the transitivity
property of equals
is not guaranteed.
equals
in class java.lang.Object
o
- the reference object with which to compare
true
if o
equals
this,
false
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |