public class Gaussian extends ContinuousKernel
0
(μ = mu, σ = sigma).Modifier and Type | Field and Description |
---|---|
static double |
CUTOFF
Default cutoff for Gaussian kernels.
|
static java.lang.String |
GUI_NAME |
static boolean |
HAS_DELAY |
static boolean |
HAS_OOBP |
static boolean |
HAS_WIDTH |
static int |
NR_EXTRA_FIELDS |
static int |
ORDER
Default order for Gaussian kernels.
|
static java.lang.String |
SHORT_NAME |
static double |
SIGMA
Default σ for Gaussian kernels.
|
Constructor and Description |
---|
Gaussian()
Constructs a standard Gaussian kernel, using
mu = 0 and
sigma = 1 . |
Gaussian(double theSigma,
double theCutoff)
Constructs a custom Gaussian kernel, using
mu = 0 and
the supplied sigma and cutoff . |
Gaussian(double theSigma,
double theCutoff,
int theOrder)
Constructs a custom Gaussian kernel, using
mu = 0 and
the supplied sigma cutoff and
order . |
Modifier and Type | Method and Description |
---|---|
double[] |
applyTo(double[] theInput)
Deprecated.
|
double[] |
applyTo(double[] theInput,
int theDelay)
Apply the kernel to the specified array, with the specified delay.
|
double |
getCorrectionFactor()
Gets the correction factor used for this
Kernel . |
java.lang.String |
getGuiText()
Deprecated.
|
boolean |
getHasDelay()
Deprecated.
|
boolean |
getHasOOBP()
Deprecated.
|
boolean |
getHasWidth()
Deprecated.
|
java.lang.String |
getInfo()
Returns the
String representation of this
Kernel . |
double[] |
getKernel()
Gets the values of this
Kernel . |
int |
getNrExtraFields()
Deprecated.
|
int |
getOrder()
Gets the order of this
Kernel . |
java.lang.String |
getShortText()
Deprecated.
|
Gaussian |
setCutoff(double theCutoff)
Sets a new
cutoff for this Kernel . |
Gaussian |
setOrder(int theOrder)
Sets a new
order , meaning the n-th derivative
of this Gaussian is calculated and used as kernel. |
Gaussian |
setOutOfBoundsPolicy(OutOfBoundsPolicy thePolicy)
Sets the new
OutOfBoundsPolicy for this
Kernel . |
Gaussian |
setSigma(double theSigma)
Sets a new
sigma (σ) for this
Kernel . |
java.lang.String |
toString()
Returns the
String representation of this
Kernel . |
public static final java.lang.String GUI_NAME
public static final java.lang.String SHORT_NAME
public static final boolean HAS_WIDTH
public static final boolean HAS_OOBP
public static final boolean HAS_DELAY
public static final int NR_EXTRA_FIELDS
public static final double SIGMA
public static final double CUTOFF
public static final int ORDER
public Gaussian()
mu = 0
and
sigma = 1
.
For each value in an input array the new value is calculated based on
the previous, current and next value(s), using the kernel
width
, and the appropriate weights.
The sigma
can be changed using the
setSigma
method.
Note that this class provides an alternative constructor,
Gaussian(double theSigma, int theWidth)
,
in which an alternative sigma
can be set directly.
Gaussian(double, double, int)
public Gaussian(double theSigma, double theCutoff)
mu = 0
and
the supplied sigma
and cutoff
.
For each value in the input array the new value is calculated based
on the previous, current and next value(s), using the kernel
width
, and the appropriate weights.
The sigma
can be changed using the
setSigma(double)
method.
The cutoff
can be changed using the
setCutoff(double)
method.
Note that this class provides an alternative constructor,
Gaussian()
, that uses sigma = 1.0
,
cutoff = 3.0
.
So, it uses the standard normal distribution, and is
known as the standard Gaussian kernel.theSigma
- The sigma
of the Kernel
.theCutoff
- The cutoff
of the Kernel
.Gaussian()
public Gaussian(double theSigma, double theCutoff, int theOrder)
mu = 0
and
the supplied sigma
cutoff
and
order
.
For each value in the input array the new value is calculated based
on the previous, current and next value(s), using the kernel
width
, and the appropriate weights.
The sigma
can be changed using the
setSigma(double)
method.
The cutoff
can be changed using the
setCutoff(double)
method.
The order
can be changed using the
setOrder(int)
method.
Note that this class provides an alternative constructor,
Gaussian()
, that uses sigma = 1.0
,
cutoff = 3.0
and order = 0
.
So, it uses the standard normal distribution, and is
known as the standard Gaussian kernel.theSigma
- The sigma
of the Kernel
.theCutoff
- The cutoff
of the Kernel
.Gaussian()
public Gaussian setOutOfBoundsPolicy(OutOfBoundsPolicy thePolicy)
OutOfBoundsPolicy
for this
Kernel
.
The OutOfBoundsPolicy
controls the value used in the
array returned by the applyTo
method, for those
values in the input array to which no whole Kernel
could
be applied.thePolicy
- The OutOfBoundsPolicy
to use.Kernel
on which this method is called.OutOfBoundsPolicy
public Gaussian setSigma(double theSigma)
sigma
(σ) for this
Kernel
.
Changing the sigma
of a Gaussian distribution influences
its bell shape.
A larger sigma
results in a flatter, wider distribution.
By default sigma = 1.0
, any new sigma
must
be
0.0 < σ < Double.POSITIVE_INFINITY
.theSigma
- The new sigma
to use.Kernel
on which this method was called.public Gaussian setCutoff(double theCutoff)
cutoff
for this Kernel
.
As a true Gaussian distribution is continuous, a cutoff
is used for discrete representations.
Changing the cutoff
influences the kernel density.
A higher cutoff
value results in a lower density, given
the same width
.
By default cutoff = 3.0
, any new cutoff
must be
0.0 < cutoff < Double.POSITIVE_INFINITY
.theCutoff
- The new cutoff
to use.Kernel
on which this method was called.public Gaussian setOrder(int theOrder)
order
, meaning the n-th derivative
of this Gaussian is calculated and used as kernel.
By default order = 0
, any new order
must be 0, 1 or 2.theOrder
- The new order
to use.Kernel
on which this method was called.getKernel()
public double[] getKernel()
Kernel
.width
, containing the values of
this Kernel
.public double getCorrectionFactor()
Kernel
.
The correction factor is used to set the total area under the
Gaussian distribution, as used by this Kernel
, to
1.0
.
As a true Gaussian distribution is continuous, a cutoff
is used for discrete representations.
As a result, the area under the curve will not exactly sum to
1.0
.
Applying the correction factor will make it so.setCutoff(double)
public int getOrder()
Kernel
.
Orders of 1 and 2 mean the 1st and 2nd derivative of the Gaussian
distribution are used for calculations using this Kernel
.Kernel
.getKernel()
@Deprecated public double[] applyTo(double[] theInput)
AbstractKernel
In general, for kernels for which AbstractKernel.getHasWidth()
returns
true
, the application of the kernel to the head and
tail of the input array is undefined.
This method will fill in the values for which this condition
applies by using the OutOfBoundsPolicy
set for the kernel.
applyTo
in class AbstractKernel
theInput
- The array to apply the kernel to.double[]
with the result.public double[] applyTo(double[] theInput, int theDelay)
AbstractKernel
The delay may be 0
, positive or negative.
For a delay of 0
the values in the return array map
directly to the input array.
For a positive delay of n
the values in the input array
are 'shifted' n
indices to the right.
For a negative delay this 'shift' is to the left.
In general, for kernels for which AbstractKernel.getHasWidth()
returns
true
, the application of the kernel to the head and
tail of the input array is undefined.
This method will fill in the values for which this condition
applies by using the OutOfBoundsPolicy
set for the kernel.
applyTo
in class AbstractKernel
theInput
- The array to apply the kernel to.theDelay
- The delay to use.double[]
with the result.@Deprecated public java.lang.String getGuiText()
AbstractKernel
For most kernels this method returns the same result as a call to
kernel.class.getSimpleName()
.
For some, the returned String
will include some
white spaces that beak up the various words, such that it forms
regular text.
getGuiText
in class AbstractKernel
String
.@Deprecated public java.lang.String getShortText()
AbstractKernel
getShortText
in class AbstractKernel
String
indicative of the class name.@Deprecated public boolean getHasWidth()
AbstractKernel
This is true
for a DiscreteKernel
, and
false
for a ContinuousKernel
.
getHasWidth
in class ContinuousKernel
true
iff the kernel has a width,
false
otherwise.ContinuousKernel
,
DiscreteKernel
@Deprecated public boolean getHasOOBP()
AbstractKernel
OutOfBoundsPolicy
.
This is true
for a DiscreteKernel
, and
false
for a ContinuousKernel
.
getHasOOBP
in class ContinuousKernel
true
iff the kernel has an out of
bounds policy, false
otherwise.OutOfBoundsPolicy
,
ContinuousKernel
,
DiscreteKernel
@Deprecated public boolean getHasDelay()
AbstractKernel
This is true
for almost all kernels, but not for
MovingAverage
.
getHasDelay
in class AbstractKernel
true
iff a delay can be set for the
kernel, false
otherwise.@Deprecated public int getNrExtraFields()
AbstractKernel
Extra fields hold kernel specific configuration settings, not shared with other kernels.
getNrExtraFields
in class AbstractKernel
public java.lang.String toString()
String
representation of this
Kernel
.
In order the items between the braces represent the:
OutOfBoundsPolicy
, sigma
,
cutoff
and order
used for this
Kernel
.toString
in class AbstractKernel
String
representation of the kernel.public java.lang.String getInfo()
String
representation of this
Kernel
.
It includes the sigma
, cutoff
,
correction
and order
used for this
Kernel
, and the values of the Kernel
itself.