Class CosineKernelDensityFunction

  • All Implemented Interfaces:
    KernelDensityFunction

    public final class CosineKernelDensityFunction
    extends java.lang.Object
    implements KernelDensityFunction
    Cosine kernel density estimator.
    Since:
    0.6.0
    Author:
    Erich Schubert
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double canonicalBandwidth()
      Get the canonical bandwidth for this kernel.
      double density​(double delta)
      Density contribution of a point at the given relative distance delta >= 0.
      double getR()
      Get the R integral of the kernel, \int K^2(x) dx
      double standardDeviation()
      Get the standard deviation of the kernel function.
      • Methods inherited from class java.lang.Object

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

      • CANONICAL_BANDWIDTH

        public static final double CANONICAL_BANDWIDTH
        Canonical bandwidth. Computed as (R / STDDEV^4)^(1/5) This is approximately: 1.7662654022050532
      • STDDEV

        private static final double STDDEV
        Standard deviation.
    • Constructor Detail

      • CosineKernelDensityFunction

        private CosineKernelDensityFunction()
        Private, empty constructor. Use the static instance!
    • Method Detail

      • density

        public double density​(double delta)
        Description copied from interface: KernelDensityFunction
        Density contribution of a point at the given relative distance delta >= 0.

        Note that for delta < 0, in particular for delta < 1, the results may become invalid. So usually, you will want to invoke this as:

        kernel.density(Math.abs(delta))

        Specified by:
        density in interface KernelDensityFunction
        Parameters:
        delta - Relative distance
        Returns:
        density contribution
      • canonicalBandwidth

        public double canonicalBandwidth()
        Description copied from interface: KernelDensityFunction
        Get the canonical bandwidth for this kernel.

        Note: R uses a different definition of "canonical bandwidth", and also uses differently scaled kernels.

        Specified by:
        canonicalBandwidth in interface KernelDensityFunction
        Returns:
        Canonical bandwidth
      • getR

        public double getR()
        Description copied from interface: KernelDensityFunction
        Get the R integral of the kernel, \int K^2(x) dx

        TODO: any better name for this?

        Specified by:
        getR in interface KernelDensityFunction
        Returns:
        R value