@Equality public abstract class StandardKernel1dShape extends Object implements Kernel1dShape
Modifier and Type | Field and Description |
---|---|
static StandardKernel1dShape |
COS
Cosine kernel shape.
|
static StandardKernel1dShape |
COS2
Cosine squared kernel shape.
|
static Kernel1d |
DELTA
Delta function kernel.
|
static StandardKernel1dShape |
EPANECHNIKOV
Epanechnikov (parabola) kernel shape.
|
static StandardKernel1dShape |
LINEAR
Linear (triangular) kernel shape.
|
static StandardKernel1dShape |
SQUARE
Rectangular kernel shape.
|
Modifier | Constructor and Description |
---|---|
protected |
StandardKernel1dShape(String name,
String description,
double normExtent,
boolean isSquare)
Constructor.
|
Modifier and Type | Method and 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.
|
static Kernel1d |
createSymmetricMeanKernel(double[] levels,
boolean isSquare)
Creates a symmetric averabing kernel based on a fixed array of
function values.
|
static Kernel1d |
createSymmetricNormalisedKernel(double[] levels,
boolean isSquare)
Creates a symmetric normalised kernel based on a fixed array of
function values.
|
static StandardKernel1dShape |
createTruncatedGaussian(double truncSigma)
Returns a kernel shape based on the Gaussian function with
truncation at a given number of standard deviations.
|
protected abstract double |
evaluate(double x)
Returns the point value of the function defining this shape
at a point a given absolute fraction of the nominal width
from the center.
|
String |
getDescription()
Returns a short description for this shape.
|
String |
getName()
Returns a one-word name for this shape.
|
double |
getNormalisedExtent()
Returns the extent of a kernel with this shape of unit nominal width.
|
static Kernel1dShape[] |
getStandardOptions()
Returns an array of the generally recommended kernel shape options.
|
boolean |
isSquare()
Indicates whether this shape has features which are intentionally
non-smooth and should be portrayed as such.
|
String |
toString() |
public static final StandardKernel1dShape SQUARE
public static final StandardKernel1dShape LINEAR
public static final StandardKernel1dShape EPANECHNIKOV
public static final StandardKernel1dShape COS
public static final StandardKernel1dShape COS2
public static final Kernel1d DELTA
protected StandardKernel1dShape(String name, String description, double normExtent, boolean isSquare)
name
- kernel shape namedescription
- short descriptionnormExtent
- kernel extent for unit nominal widthisSquare
- true iff kernel is considered non-smoothprotected abstract double evaluate(double x)
x
out of the range
0<=x<=getNormalisedExtent()
has an undefined
effect; the function value is assumed symmetric and zero for
larger absolute values.x
- normalised absolute distance in range 0..normExtentx
public double getNormalisedExtent()
evaluate(x)
method for
x
greater than the value returned from this method
is taken to be zero.public boolean isSquare()
public String getName()
getName
in interface Kernel1dShape
public String getDescription()
getDescription
in interface Kernel1dShape
public Kernel1d createFixedWidthKernel(double width)
Kernel1dShape
createFixedWidthKernel
in interface Kernel1dShape
width
- half-widthpublic Kernel1d createMeanKernel(double width)
Kernel1dShape
createMeanKernel
in interface Kernel1dShape
width
- half-widthpublic Kernel1d createKnnKernel(double k, boolean isSymmetric, int minWidth, int maxWidth)
Kernel1dShape
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.
createKnnKernel
in interface Kernel1dShape
k
- number of nearest neighbours included in the distance
that characterises the smoothingisSymmetric
- true for bidirectional KNN search,
false for unidirectionalminWidth
- minimum smoothing widthmaxWidth
- maximum smoothing widthpublic static Kernel1dShape[] getStandardOptions()
public static StandardKernel1dShape createTruncatedGaussian(double truncSigma)
truncSigma
- number of sigma at which to truncate the kernelpublic static Kernel1d createSymmetricNormalisedKernel(double[] levels, boolean isSquare)
levels
array gives a list of
the values at x=0, 1 (and -1), 2 (and -2), ....levels
- kernel function values on 1d grid starting from 0isSquare
- true iff the kernel is considered non-smoothpublic static Kernel1d createSymmetricMeanKernel(double[] levels, boolean isSquare)
levels
array gives a list of
the values at x=0, 1 (and -1), 2 (and -2), ....levels
- kernel function values on 1d grid starting from 0isSquare
- true iff the kernel is considered non-smoothCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.