|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.misc.monotone.DistributionUtils
public class DistributionUtils
Class with some simple methods acting on
CumulativeDiscreteDistribution.
All of the methods in this class are very easily implemented
and the main use of this class is to gather all these methods
in a single place. It could be argued that some of the methods
should be implemented in the class
CumulativeDiscreteDistribution
itself.
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 | |
---|---|
DistributionUtils()
|
Method Summary | |
---|---|
static double[] |
getDistributionArray(DiscreteEstimator df)
Converts a DiscreteEstimator to an array of
doubles. |
static CumulativeDiscreteDistribution |
getMaximalCumulativeDiscreteDistribution(int numClasses)
Get the maximal CumulativeDiscreteDistribution
over numClasses elements. |
static CumulativeDiscreteDistribution |
getMinimalCumulativeDiscreteDistribution(int numClasses)
Get the minimal CumulativeDiscreteDistribution
over numClasses elements. |
java.lang.String |
getRevision()
Returns the revision string. |
static CumulativeDiscreteDistribution |
interpolate(CumulativeDiscreteDistribution cdf1,
CumulativeDiscreteDistribution cdf2,
double s)
Compute a linear interpolation between the two given CumulativeDiscreteDistribution. |
static CumulativeDiscreteDistribution |
interpolate(CumulativeDiscreteDistribution cdf1,
CumulativeDiscreteDistribution cdf2,
double[] s)
Compute a linear interpolation between the two given CumulativeDiscreteDistribution. |
static DiscreteDistribution |
interpolate(DiscreteDistribution ddf1,
DiscreteDistribution ddf2,
double s)
Compute a linear interpolation between the two given DiscreteDistribution. |
static CumulativeDiscreteDistribution |
takeMax(CumulativeDiscreteDistribution cdf1,
CumulativeDiscreteDistribution cdf2)
Create a new CumulativeDiscreteDistribution
that is the maximum of the two given
CumulativeDiscreteDistribution. |
static CumulativeDiscreteDistribution |
takeMin(CumulativeDiscreteDistribution cdf1,
CumulativeDiscreteDistribution cdf2)
Create a new CumulativeDiscreteDistribution
that is the minimum of the two given
CumulativeDiscreteDistribution. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DistributionUtils()
Method Detail |
---|
public static CumulativeDiscreteDistribution interpolate(CumulativeDiscreteDistribution cdf1, CumulativeDiscreteDistribution cdf2, double s) throws java.lang.IllegalArgumentException
CumulativeDiscreteDistribution.
cdf1
- the first CumulativeDiscreteDistribution
cdf2
- the second CumulativeDiscreteDistribution
s
- the interpolation parameter
java.lang.IllegalArgumentException
- if the two distributions
don't have the same size or if the parameter s
is not in the range [0,1]public static CumulativeDiscreteDistribution interpolate(CumulativeDiscreteDistribution cdf1, CumulativeDiscreteDistribution cdf2, double[] s) throws java.lang.IllegalArgumentException
CumulativeDiscreteDistribution.
cdf1
- the first CumulativeDiscreteDistribution
cdf2
- the second CumulativeDiscreteDistribution
s
- the interpolation parameters, only the relevant number
of entries is used, so the array may be longer than the common
length of cdf1
and cdf2
cd.getCumulativeProbability(i) =
(1-s[i]) × cdf1.getCumulativeProbability(i) +
s[i] × cdf2.getCumulativeProbability(i)
java.lang.IllegalArgumentException
- if the two distributions
don't have the same size or if the array s
contains parameters not in the range [0,1]
public static DiscreteDistribution interpolate(DiscreteDistribution ddf1, DiscreteDistribution ddf2, double s) throws java.lang.IllegalArgumentException
DiscreteDistribution.
ddf1
- the first DiscreteDistribution
ddf2
- the second DiscreteDistribution
s
- the interpolation parameter
(1 - s) × ddf1 + s × ddf2
java.lang.IllegalArgumentException
- if the two distributions
don't have the same size or if the parameter s
is not in the range [0,1]public static CumulativeDiscreteDistribution takeMin(CumulativeDiscreteDistribution cdf1, CumulativeDiscreteDistribution cdf2) throws java.lang.IllegalArgumentException
CumulativeDiscreteDistribution
that is the minimum of the two given
CumulativeDiscreteDistribution.
Each component of the resulting probability distribution
is the minimum of the two corresponding components.
cdf1
- first CumulativeDiscreteDistribution
cdf2
- second CumulativeDiscreteDistribution
java.lang.IllegalArgumentException
- if the two distributions
dont't have the same lengthpublic static CumulativeDiscreteDistribution takeMax(CumulativeDiscreteDistribution cdf1, CumulativeDiscreteDistribution cdf2) throws java.lang.IllegalArgumentException
CumulativeDiscreteDistribution
that is the maximum of the two given
CumulativeDiscreteDistribution.
Each component of the resulting probability distribution
is the maximum of the two corresponding components.
Note: despite of its name, the returned cumulative probability
distribution is dominated by both the arguments of this method.
cdf1
- first CumulativeDiscreteDistribution
cdf2
- second CumulativeDiscreteDistribution
java.lang.IllegalArgumentException
- if the two distributions
dont't have the same lengthpublic static double[] getDistributionArray(DiscreteEstimator df)
DiscreteEstimator
to an array of
doubles.
df
- the DiscreteEstimator
to be converted
DiscreteEstimator
public static CumulativeDiscreteDistribution getMinimalCumulativeDiscreteDistribution(int numClasses) throws java.lang.IllegalArgumentException
CumulativeDiscreteDistribution
over numClasses
elements. This means that
a probability of one is assigned to the first element.
numClasses
- the number of elements
CumulativeDiscreteDistribution
over the requested number of elements
java.lang.IllegalArgumentException
- if numClasses
is smaller or equal than 0public static CumulativeDiscreteDistribution getMaximalCumulativeDiscreteDistribution(int numClasses) throws java.lang.IllegalArgumentException
CumulativeDiscreteDistribution
over numClasses
elements. This means that
a probability of one is assigned to the last class.
numClasses
- the number of elements
CumulativeDiscreteDistribution
over the requested number of elements
java.lang.IllegalArgumentException
- if numClasses
is smaller or equal than 0public java.lang.String getRevision()
getRevision
in interface RevisionHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |