jsat.distributions.multivariate
Class ProductKDE
- java.lang.Object
-
- jsat.distributions.multivariate.MultivariateDistributionSkeleton
-
- jsat.distributions.multivariate.MultivariateKDE
-
- jsat.distributions.multivariate.ProductKDE
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, MultivariateDistribution
public class ProductKDE extends MultivariateKDE
The Product Kernel Density Estimator is a generalization of theKernelDensityEstimatorto the multivariate case. This is done by using a kernel and bandwidth for each dimension, such that the bandwidth for each dimension can be determined using the same methods as the univariate KDE. This can simplify the difficulty in bandwidth selection for the multivariate case.- See Also:
MetricKDE, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ProductKDE()Creates a new KDE that uses theEpanechnikovKFkernel.ProductKDE(KernelFunction k)Creates a new KDE that uses the specified kernel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ProductKDEclone()KernelFunctiongetKernelFunction()java.util.List<VecPaired<VecPaired<Vec,java.lang.Integer>,java.lang.Double>>getNearby(Vec x)Returns the list of vectors that have a non zero contribution to the density of the query point x.java.util.List<VecPaired<VecPaired<Vec,java.lang.Integer>,java.lang.Double>>getNearbyRaw(Vec x)Returns the list of vectors that have a non zero contribution to the density of the query point x.doublepdf(Vec x)Returns the probability of a given vector from this distribution.java.util.List<Vec>sample(int count, java.util.Random rand)Performs sampling on the current distribution.voidscaleBandwidth(double scale)A caller may want to increase or decrease the bandwidth after training has been completed to get smoother model, or decrease it to observe behavior.<V extends Vec>
booleansetUsingData(java.util.List<V> dataSet, boolean parallel)Sets the parameters of the distribution to attempt to fit the given list of vectors.-
Methods inherited from class jsat.distributions.multivariate.MultivariateDistributionSkeleton
logPdf
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.distributions.multivariate.MultivariateDistribution
logPdf, pdf, setUsingData, setUsingData, setUsingData, setUsingDataList
-
-
-
-
Constructor Detail
-
ProductKDE
public ProductKDE()
Creates a new KDE that uses theEpanechnikovKFkernel.
-
ProductKDE
public ProductKDE(KernelFunction k)
Creates a new KDE that uses the specified kernel- Parameters:
k- the kernel method to use
-
-
Method Detail
-
clone
public ProductKDE clone()
- Specified by:
clonein interfaceMultivariateDistribution- Specified by:
clonein classMultivariateKDE
-
getNearby
public java.util.List<VecPaired<VecPaired<Vec,java.lang.Integer>,java.lang.Double>> getNearby(Vec x)
Description copied from class:MultivariateKDEReturns the list of vectors that have a non zero contribution to the density of the query point x. Each vector is paired with its integer index from the original constructing list vectors, and a double indicating its weight given the kernel function in use.- Specified by:
getNearbyin classMultivariateKDE- Parameters:
x- the query point- Returns:
- the list of near by vectors and their weights
-
getNearbyRaw
public java.util.List<VecPaired<VecPaired<Vec,java.lang.Integer>,java.lang.Double>> getNearbyRaw(Vec x)
Description copied from class:MultivariateKDEReturns the list of vectors that have a non zero contribution to the density of the query point x. Each vector is paired with its integer index from the original constructing list vectors, and a double indicating its distance from the query point divided by the bandwidth of the point.- Specified by:
getNearbyRawin classMultivariateKDE- Parameters:
x- the query point- Returns:
- the list of near by vectors and their weights
-
pdf
public double pdf(Vec x)
Description copied from interface:MultivariateDistributionReturns the probability of a given vector from this distribution. By definition, the probability will always be in the range [0, 1].- Parameters:
x- the vector the get the log probability of- Returns:
- the probability
-
setUsingData
public <V extends Vec> boolean setUsingData(java.util.List<V> dataSet, boolean parallel)
Description copied from interface:MultivariateDistributionSets the parameters of the distribution to attempt to fit the given list of vectors. All vectors are assumed to have the same weight.- Type Parameters:
V- the vector type- Parameters:
dataSet- the list of data pointsparallel-trueif the training should be done using multiple-cores,falsefor single threaded.- Returns:
- true if the distribution was fit to the data, or false if the distribution could not be fit to the data set.
-
sample
public java.util.List<Vec> sample(int count, java.util.Random rand)
Description copied from interface:MultivariateDistributionPerforms sampling on the current distribution.- Parameters:
count- the number of iid samples to drawrand- the source of randomness- Returns:
- a list of sample vectors from this distribution
-
getKernelFunction
public KernelFunction getKernelFunction()
- Specified by:
getKernelFunctionin classMultivariateKDE- Returns:
- the kernel function used
-
scaleBandwidth
public void scaleBandwidth(double scale)
Description copied from class:MultivariateKDEA caller may want to increase or decrease the bandwidth after training has been completed to get smoother model, or decrease it to observe behavior. This method will scaled the bandwidth of each data point by the given factor- Specified by:
scaleBandwidthin classMultivariateKDE- Parameters:
scale- the value to scale the bandwidth used
-
-
DataMelt 3.0 © DataMelt by jWork.ORG