Class KernelDensityEstimator


  • public class KernelDensityEstimator
    extends java.lang.Object
    Estimate density given an array of points.

    Estimates a density using a variable width kernel density estimation.

    Since:
    0.2
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double[] dens
      Result storage: density
      private double[] var
      Result storage: variance / quality
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double[] getDensity()
      Retrieve density array (NO copy)
      double[] getVariance()
      Retrieve variance/quality array (NO copy)
      private void process​(double[] data, double min, double max, KernelDensityFunction kernel, int window, double epsilon)
      Process a new array
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dens

        private double[] dens
        Result storage: density
      • var

        private double[] var
        Result storage: variance / quality
    • Constructor Detail

      • KernelDensityEstimator

        public KernelDensityEstimator​(double[] data,
                                      double min,
                                      double max,
                                      KernelDensityFunction kernel,
                                      int window,
                                      double epsilon)
        Initialize and execute kernel density estimation.
        Parameters:
        data - data to use (must be sorted!)
        min - minimum value
        max - maximum value
        kernel - Kernel function to use
        window - window size
        epsilon - Precision threshold
      • KernelDensityEstimator

        public KernelDensityEstimator​(double[] data,
                                      KernelDensityFunction kernel,
                                      double epsilon)
        Process an array of data
        Parameters:
        data - data to process (must be sorted!)
        kernel - Kernel function to use.
        epsilon - Precision threshold
    • Method Detail

      • process

        private void process​(double[] data,
                             double min,
                             double max,
                             KernelDensityFunction kernel,
                             int window,
                             double epsilon)
        Process a new array
        Parameters:
        data - data to use (must be sorted!)
        min - minimum value
        max - maximum value
        kernel - Kernel function to use
        window - window size
        epsilon - Precision threshold
      • getDensity

        public double[] getDensity()
        Retrieve density array (NO copy)
        Returns:
        density array
      • getVariance

        public double[] getVariance()
        Retrieve variance/quality array (NO copy)
        Returns:
        variance array