Interface Kernel1dShape

  • All Known Implementing Classes:
    StandardKernel1dShape

    public interface Kernel1dShape
    Factory interface for for Kernel1d smoothing functional forms.

    Some implementations are provided in the StandardKernel1dShape class.

    Since:
    2 Mar 2015
    Author:
    Mark Taylor
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Kernel1d createFixedWidthKernel​(double width)
      Creates a fixed width kernel with a given nominal width.
      Kernel1d createKnnKernel​(double k, boolean isSymmetric, int minWidth, int maxWidth)
      Creates an adaptive kernel that uses a K-nearest-neighbours algorithm to determine local smoothing width, so that the width of the kernel is determined by the distance (number of 1-pixel bins) within which the given number k of samples is found.
      Kernel1d createMeanKernel​(double width)
      Creates an averaging kernel with a given nominal fixed width.
      java.lang.String getDescription()
      Returns a short description for this shape.
      java.lang.String getName()
      Returns a one-word name for this shape.
    • Method Detail

      • getName

        java.lang.String getName()
        Returns a one-word name for this shape.
        Returns:
        name
      • getDescription

        java.lang.String getDescription()
        Returns a short description for this shape.
        Returns:
        description
      • createFixedWidthKernel

        Kernel1d createFixedWidthKernel​(double width)
        Creates a fixed width kernel with a given nominal width. The width is some kind of characteristic half-width in one direction of the smoothing function. It is in units of grid points (array element spacing). It would generally be less than or equal to the kernel's extent.
        Parameters:
        width - half-width
        Returns:
        new kernel
      • createMeanKernel

        Kernel1d createMeanKernel​(double width)
        Creates an averaging kernel with a given nominal fixed width. The 'convolution' it performs is not really a convolution, instead it's a sort of weighted moving average. This is a smoothing that's suitable for intensive quantities. Using proper convolution for intensive quantities like the mean or median is problematic if there may be blank values in the input array, since the smoothed value has to keep track of how many non-blank values it has encountered.
        Parameters:
        width - half-width
        Returns:
        new kernel
      • createKnnKernel

        Kernel1d createKnnKernel​(double k,
                                 boolean isSymmetric,
                                 int minWidth,
                                 int maxWidth)
        Creates an adaptive kernel that uses a K-nearest-neighbours algorithm to determine local smoothing width, so that the width of the kernel is determined by the distance (number of 1-pixel bins) within which the given number k of samples is found.

        The nearest neighbour search may be symmetric or asymmetric. In the asymmetric case, the kernel width is determined separately for the positive and negative directions along the axis.

        Minimum and maximum smoothing widths are also supplied as bounds on the smoothing width for the case that the samples are very dense or very spread out (the latter case covers the edge of the data region as well). If minWidth==maxWidth, the result is a fixed-width kernel.

        Parameters:
        k - number of nearest neighbours included in the distance that characterises the smoothing
        isSymmetric - true for bidirectional KNN search, false for unidirectional
        minWidth - minimum smoothing width
        maxWidth - maximum smoothing width
        Returns:
        new kernel