public class KernelDensityFunction extends java.lang.Object implements DensityFunction
Modifier and Type | Field and Description |
---|---|
static java.util.logging.Logger |
log |
Constructor and Description |
---|
KernelDensityFunction(java.util.Collection<double[]> points)
Creates a new kernel density function with the given points
|
KernelDensityFunction(double[][] points)
Creates a new kernel density function with the given points
|
Modifier and Type | Method and Description |
---|---|
KernelDensityFunction |
copy()
Returns a copy of the density function
|
java.util.Map<double[],java.lang.Double> |
discretise(int nbBuckets)
Returns a set of discrete values for the density function.
|
java.util.List<org.w3c.dom.Element> |
generateXML(org.w3c.dom.Document doc)
Converts the distribution to a Gaussian distribution and returns its XML
representation.
|
double[] |
getBandwidth()
Returns the bandwidth defined for the KDE
|
double |
getCDF(double... x)
Returns the cumulative probability distribution for the KDE.
|
double |
getDensity(double... x)
Returns the density for the given point
|
int |
getDimensions()
Returns the dimensionality of the KDE.
|
double[] |
getMean()
Returns the mean of the KDE.
|
double[] |
getVariance()
Returns the variance of the KDE.
|
int |
hashCode()
Returns the hashcode for the function
|
double[] |
sample()
Samples from the kernel density function, first picking one of the point, and
then deviating from it according to a Gaussian centered around it
|
java.lang.String |
toString()
Return a pretty print for the kernel density
|
public KernelDensityFunction(double[][] points)
points
- the pointspublic KernelDensityFunction(java.util.Collection<double[]> points)
points
- the pointspublic double[] getBandwidth()
public 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 values to extractpublic KernelDensityFunction 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)
generateXML
in interface DensityFunction
doc
- the XML document