public class ExponentialMovingAverage extends ContinuousKernel
FACTOR.setFactor(double)| Modifier and Type | Field and Description |
|---|---|
static double |
FACTOR
The default decay factor for ExponentialMovingAverage 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 java.lang.String |
SHORT_NAME |
| Constructor and Description |
|---|
ExponentialMovingAverage()
Constructs an ExponentialMovingAverage kernel.
|
ExponentialMovingAverage(double theFactor)
Constructs an ExponentialMovingAverage kernel.
|
| 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.
|
java.lang.String |
getGuiText()
Deprecated.
|
boolean |
getHasDelay()
Deprecated.
|
boolean |
getHasOOBP()
Deprecated.
|
boolean |
getHasWidth()
Deprecated.
|
static double[] |
getKernel(double theFactor,
double theThreshold,
boolean inverse)
Constructs an array with a size determined using
theThreshold, and with values that either increase or
decrease based on inverse. |
static double[] |
getKernel(double theFactor,
int theWidth,
boolean inverse)
Constructs an array of size
theWidth, with values that
either increase or decrease based on inverse. |
int |
getNrExtraFields()
Deprecated.
|
java.lang.String |
getShortText()
Deprecated.
|
ExponentialMovingAverage |
setFactor(double theFactor)
Sets the decay factor used for the 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 FACTOR
setFactor(double),
Constant Field Valuespublic ExponentialMovingAverage()
public ExponentialMovingAverage(double theFactor)
theFactor - The decay or increase factor of the
Kernel.public ExponentialMovingAverage setFactor(double theFactor)
The factor must lie within the range [0, 1], else the old factor will remain in use.
A factor of 1.0 has the effect of not using previous
values to calculate the current one.
Reversely, a factor of 0.0 has the effect of not
applying any decay to previous values when calculating the current
one.
The last use effectively turns this type of kernel into a
MovingAverage one with the same width.
theFactor - The decay factor to use.Kernel on which this method is called.MovingAveragepublic static double[] getKernel(double theFactor,
int theWidth,
boolean inverse)
theWidth, with values that
either increase or decrease based on inverse.
If increase is true the last value will be
1.0 and values are calculated using the formula:
output[i] = .
theFactor^i
If increase is false the first value will
be 1.0 and values are calculated using the formula:
output[i] = .theFactor^i
theFactor - The decay factor.theWidth - The size of the output array.inverse - Output array values should increase if
true, or decrease if false.double[] with increasing or decreasing values.public static double[] getKernel(double theFactor,
double theThreshold,
boolean inverse)
theThreshold, and with values that either increase or
decrease based on inverse.
The size of the output array is calculated using the following
formula:
(int)(Math.log(theThreshold) / Math.log(theFactor)) + 1.
If increase is true the last value will be
1.0 and values are calculated using the formula:
output[i] = .
theFactor^i
If increase is false the first value will
be 1.0 and values are calculated using the formula:
output[i] = .theFactor^i
theFactor - The decay factor.theThreshold - The size of the output array.inverse - Output array values should increase if
true, or decrease if false.double[] with increasing or decreasing values.@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 AbstractKerneltheInput - 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 AbstractKerneltheInput - 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 AbstractKernelString.@Deprecated public java.lang.String getShortText()
AbstractKernelgetShortText in class AbstractKernelString indicative of the class name.@Deprecated public boolean getHasWidth()
AbstractKernel
This is true for a DiscreteKernel, and
false for a ContinuousKernel.
getHasWidth in class ContinuousKerneltrue iff the kernel has a width,
false otherwise.ContinuousKernel,
DiscreteKernel@Deprecated public boolean getHasOOBP()
AbstractKernelOutOfBoundsPolicy.
This is true for a DiscreteKernel, and
false for a ContinuousKernel.
getHasOOBP in class ContinuousKerneltrue 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 AbstractKerneltrue iff a delay can be set for the
kernel, false otherwise.@Deprecated public int getNrExtraFields()
AbstractKernelExtra fields hold kernel specific configuration settings, not shared with other kernels.
getNrExtraFields in class AbstractKernelpublic java.lang.String toString()
String representation of this
Kernel.
In item between the braces represent the factor used for
this Kernel.toString in class AbstractKernelString representation of the kernel.