public class DiscreteDensityFunction extends java.lang.Object implements DensityFunction
Modifier and Type | Field and Description |
---|---|
static java.util.logging.Logger |
log |
Constructor and Description |
---|
DiscreteDensityFunction(java.util.Map<double[],java.lang.Double> points)
Creates a new discrete density function, given the set of points
|
Modifier and Type | Method and Description |
---|---|
DiscreteDensityFunction |
copy()
Returns a copy of the density function
|
java.util.Map<double[],java.lang.Double> |
discretise(int nbBuckets)
Returns the points for this distribution.
|
java.util.List<org.w3c.dom.Element> |
generateXML(org.w3c.dom.Document doc)
Returns the XML representation (as a list of XML elements) of the density
function
|
double |
getCDF(double... x)
Returns the cumulative distribution for the distribution (by counting all the
points with a value that is lower than x).
|
double |
getDensity(double... x)
Returns the density for a given point.
|
int |
getDimensions()
Returns the dimensionality of the distribution.
|
double[] |
getMean()
Returns the means of the distribution (calculated like for a categorical
distribution).
|
double[] |
getVariance()
Returns the variance of the distribution (calculated like for a categorical
distribution)
|
int |
hashCode()
Returns the hashcode for the function
|
double[] |
sample()
Samples according to the density function
|
java.lang.String |
toString()
Returns a pretty print representation of the function
|
public DiscreteDensityFunction(java.util.Map<double[],java.lang.Double> points)
points
- a set of (value,prob) pairspublic double getDensity(double... x)
getDensity
in interface DensityFunction
x
- the pointpublic double[] sample()
sample
in interface DensityFunction
public java.util.Map<double[],java.lang.Double> discretise(int nbBuckets)
discretise
in interface DensityFunction
nbBuckets
- the number of discretisation bucketspublic DiscreteDensityFunction copy()
copy
in interface DensityFunction
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int getDimensions()
getDimensions
in interface DensityFunction
public double[] getMean()
getMean
in interface DensityFunction
public double[] getVariance()
getVariance
in interface DensityFunction
public double getCDF(double... x)
getCDF
in interface DensityFunction
x
- the (possibly multivariate) point xpublic java.util.List<org.w3c.dom.Element> generateXML(org.w3c.dom.Document doc)
DensityFunction
generateXML
in interface DensityFunction
doc
- the XML document for the node