|
JMSLTM Numerical Library 5.0.1 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.imsl.datamining.neural.ScaleFilter
public class ScaleFilter
Scales or unscales continuous data prior to its use in neural network training, testing, or forecasting.
Bounded scaling is used to ensure that the values in the scaled array fall between a lower and upper bound. The scale limits have the following interpretation:
| Argument | Interpretation |
realMin |
The lowest value expected in x. |
realMax |
The largest value expected in x. |
targetMin |
The lower bound for the values in the scaled data. |
targetMax |
The upper bound for the values in the scaled data. |
The scale limits are set using the method setBounds.
The specific scaling used is controlled by the argument
scalingMethod used when constructing the filter object.
If scalingMethod is NO_SCALING, then no scaling is performed
on the data.
If the scalingMethod is BOUNDED_SCALING then the bounded method
of scaling and unscaling is applied to x. The scaling operation
is conducted using the scale limits set in method setBounds,
using the following calculation:
![]()
![]()
If scalingMethod is one of UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV,
UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD, BOUNDED_Z_SCORE_SCALING_MEAN_STDEV, or
BOUNDED_Z_SCORE_SCALING_MEDIAN_MAD, then the z-score method of scaling is
used. These calculations are based upon the following scaling calculation:
![]()
If scalingMethod is UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV,
or BOUNDED_Z_SCORE_SCALING_MEAN_STDEV, then a and b are the arithmetic average
and sample standard deviation of the training data.
If scalingMethod is UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD
or BOUNDED_Z_SCORE_SCALING_MEDIAN_MAD, then a and b are the median and
, where
is a
robust estimate of the population standard deviation:
![]()
![]()
If the method decode is called
then an unscaling operation is conducted by inverting using:
![]()
If scalingMethod is
UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV or
UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD, then a scaling operation
is conducted
using the z-score calculation:
![]()
scalingMethod is UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV then
center is set equal to the arithmetic average
x, and spread is set equal to the
sample standard deviation of x.
If scalingMethod is UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD then
center is set equal to the median x, and spread is set equal to the
Mean Absolute Difference (MAD).
The method decode can be used to unfilter data using the
the inverse calculation for the above equation:
![]()
This method is essentially the same as the z-score calculation described
above with additional scaling or unscaling using
the scale limits set in method setBounds. The scaling operation is conducted
using the well known z-score calculation:
![]()
scalingMethod is UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV then
center is set equal to the arithmetic average
x, and spread is set equal to the
sample standard deviation of x.
If scalingMethod is UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD then
center is set equal to the median x, and spread is set equal to the
Mean Absolute Difference (MAD).
The method decode can be used to unfilter data using the
the inverse calculation for the above equation:
![]()
| Field Summary | |
|---|---|
static int |
BOUNDED_SCALING
Flag to indicate bounded scaling. |
static int |
BOUNDED_Z_SCORE_SCALING_MEAN_STDEV
Flag to indicate bounded z-score scaling using the mean and standard deviation. |
static int |
BOUNDED_Z_SCORE_SCALING_MEDIAN_MAD
Flag to indicate bounded z-score scaling using the median and mean absolute difference. |
static int |
NO_SCALING
Flag to indicate no scaling. |
static int |
UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV
Flag to indicate unbounded z-score scaling using the mean and standard deviation. |
static int |
UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD
Flag to indicate unbounded z-score scaling using the median and mean absolute difference. |
| Constructor Summary | |
|---|---|
ScaleFilter(int scalingMethod)
Constructor for ScaleFilter. |
|
| Method Summary | |
|---|---|
double |
decode(double z)
Unscales a value. |
double[] |
decode(double[] z)
Unscales an array of values. |
void |
decode(int columnIndex,
double[][] z)
Unscales a single column of a two dimensional array of values. |
double |
encode(double x)
Scales a value. |
double[] |
encode(double[] x)
Scales an array of values. |
void |
encode(int columnIndex,
double[][] x)
Scales a single column of a two dimensional array of values. |
double[] |
getBounds()
Retrieves bounds used during bounded scaling. |
double |
getCenter()
Retrieves the measure of center to be used during z-score scaling. |
double |
getSpread()
Retrieves the measure of spread to be used during scaling. |
void |
setBounds(double realMin,
double realMax,
double targetMin,
double targetMax)
Sets bounds to be used during bounded scaling and unscaling. |
void |
setCenter(double center)
Set the measure of center to be used during z-score scaling. |
void |
setSpread(double spread)
Set the measure of spread to be used during z-score scaling. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int BOUNDED_SCALING
public static final int BOUNDED_Z_SCORE_SCALING_MEAN_STDEV
public static final int BOUNDED_Z_SCORE_SCALING_MEDIAN_MAD
public static final int NO_SCALING
public static final int UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV
public static final int UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD
| Constructor Detail |
|---|
public ScaleFilter(int scalingMethod)
ScaleFilter.
scalingMethod - An int specifying the scaling method to be applied.
scalingMethod is specified by:
NO_SCALING,
BOUNDED_SCALING,
UNBOUNDED_Z_SCORE_SCALING_MEAN_STDEV,
UNBOUNDED_Z_SCORE_SCALING_MEDIAN_MAD,
BOUNDED_Z_SCORE_SCALING_MEAN_STDEV, or
BOUNDED_Z_SCORE_SCALING_MEDIAN_MAD.| Method Detail |
|---|
public double decode(double z)
z - A double containing the value to be unscaled.
double containing the filtered data.public double[] decode(double[] z)
z - A double array of values to be unscaled.
double array containing the filtered data.
public void decode(int columnIndex,
double[][] z)
columnIndex - An int specifying the index of the column
of z to unscale. Indexing is zero-based.z - A double matrix containing the values to be unscaled. Its
columnIndex-th column is modified in place.public double encode(double x)
x - A double containing the value to be scaled.
double containing the scaled value.public double[] encode(double[] x)
x - A double array containing the data to be scaled.
double array containing the scaled data.
public void encode(int columnIndex,
double[][] x)
columnIndex - An int specifying the index of the column
of x to scale. Indexing is zero-based.x - A double matrix containing the value to be
scaled. Its columnIndex-th column is
modified in place.public double[] getBounds()
double array of length 4 containing the values
| i | result[i] |
0 | realMin. Lowest expected value in the data to be filtered. |
1 | realMax. Largest expected value in the data to be filtered. |
2 | targetMin. Lowest allowed value in the filtered data. |
3 | targetMax. Largest allowed value in the filtered data. |
public double getCenter()
double containing the measure of center to be
used during z-score scaling.public double getSpread()
double containing the measure of spread to be
used during scaling.
public void setBounds(double realMin,
double realMax,
double targetMin,
double targetMax)
encode or
decode. Otherwise the default bounds are
realMin = 0, realMax = 1, targetMin = 0, and
targetMax = 1. These bounds are ignored for unbounded scaling.
realMin - A double containing the lowest expected value in the data to be filtered.realMax - A double containing the largest expected value in the data to be filtered.targetMin - A double containing the lowest allowed value in the filtered data.targetMax - A double containing the largest allowed value in the filtered data.public void setCenter(double center)
center - A double containing the measure of
center to be used during scaling. If this method
is not called then the measure of center is
computed from the data.public void setSpread(double spread)
spread - A double containing the measure of
spread to be used during z-score scaling. If this method
is not called then the measure of spread is
computed from the data.
|
JMSLTM Numerical Library 5.0.1 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||