public class ThresholdFunction extends AbstractUnivariateScalarFunction implements Vectorizable
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_HIGH_VALUE
Default high value, 1.0
|
static double |
DEFAULT_LOW_VALUE
Default low value, -1.0
|
static double |
DEFAULT_THRESHOLD
Default threshold, 0.0
|
| Constructor and Description |
|---|
ThresholdFunction()
Default constructor
|
ThresholdFunction(double threshold)
Creates a new instance of ThresholdFunction
|
ThresholdFunction(double threshold,
double lowValue,
double highValue)
Creates a new instance of ThresholdFunction
|
| Modifier and Type | Method and Description |
|---|---|
ThresholdFunction |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Converts this function from its parameters, which consists of the
threshold value
|
Vector |
convertToVector()
Converts this function into its parameters, which consists of the
threshold value
|
double |
evaluate(double input)
Maps the input onto the set {LOW_VALUE, HIGH_VALUE}
|
double |
getHighValue()
Getter for highValue
|
double |
getLowValue()
Getter for lowValue
|
double |
getThreshold()
Getter for threshold
|
void |
setHighValue(double highValue)
Setter for highValue
|
void |
setLowValue(double lowValue)
Setter for lowValue
|
void |
setThreshold(double threshold)
Setter for threshold
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevaluate, evaluateAsDoublepublic static final double DEFAULT_THRESHOLD
public static final double DEFAULT_LOW_VALUE
public static final double DEFAULT_HIGH_VALUE
public ThresholdFunction()
public ThresholdFunction(double threshold)
threshold - Current threshold, below which a value is assigned lowValue, above
which (or equal to) is assigned highValuepublic ThresholdFunction(double threshold,
double lowValue,
double highValue)
threshold - Current threshold, below which a value is assigned lowValue, above
which (or equal to) is assigned highValuelowValue - Values below threshold are assigned this valuehighValue - Values above (or equal to) threshold are assigned this valuepublic ThresholdFunction clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface Vectorizableclone in interface CloneableSerializableclone in class AbstractCloneableSerializablepublic double evaluate(double input)
evaluate in interface UnivariateScalarFunctioninput - Input to considerpublic Vector convertToVector()
convertToVector in interface Vectorizablepublic void convertFromVector(Vector parameters)
convertFromVector in interface Vectorizableparameters - one-element Vector specifying the threshold valuepublic double getThreshold()
public void setThreshold(double threshold)
threshold - Current threshold, below which a value is assigned LOW_VALUE, above
which (or equal to) is assigned HIGH_VALUEpublic double getHighValue()
public void setHighValue(double highValue)
highValue - Values above (or equal to) threshold are assigned this valuepublic double getLowValue()
public void setLowValue(double lowValue)
lowValue - Values below threshold are assigned this value