learn
Class DiscreteVariable
java.lang.Object
|
+--learn.Variable
|
+--learn.DiscreteVariable
- class DiscreteVariable
- extends Variable
- implements java.io.Serializable
The DiscreteVariable
class provides the support necessary
for variables that can take on a predefined set of numeric or symbolic
values.
- See Also:
- Serialized Form
Field Summary |
protected int |
max
|
protected int |
min
|
Constructor Summary |
DiscreteVariable(java.lang.String name)
Creates a DiscreteVariable with the given name. |
Method Summary |
void |
computeStatistics(java.lang.String inValue)
Used within a DataSet to compute the minimum and maximum value
for the variable. |
java.lang.String |
getDecodedValue(double[] act,
int start)
Retrieves the value of the given activation in a format that can be
displayed. |
int |
getNormalizedSize()
Retrieves the number of discrete values the varible can take. |
int |
normalize(java.lang.String inValue,
double[] outArray,
int inx)
Converts a symbol to a one-of-N code. |
void |
setMax(int max)
Set the maximum value for the variable. |
void |
setMin(int min)
Set the minimum value for the variable. |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
min
protected int min
max
protected int max
DiscreteVariable
public DiscreteVariable(java.lang.String name)
- Creates a
DiscreteVariable
with the given name.
- Parameters:
name
- the String name given to the variable
setMin
public void setMin(int min)
- Set the minimum value for the variable.
- Parameters:
min
- the int minimum value for the variable
setMax
public void setMax(int max)
- Set the maximum value for the variable.
- Parameters:
max
- the int maximum value for the variable
computeStatistics
public void computeStatistics(java.lang.String inValue)
- Used within a
DataSet
to compute the minimum and maximum value
for the variable.
- Parameters:
inValue
- the String that contains the value used to determine minimum
or maximum value for the variable.- Overrides:
- computeStatistics in class Variable
normalize
public int normalize(java.lang.String inValue,
double[] outArray,
int inx)
- Converts a symbol to a one-of-N code.
- Parameters:
inValue
- the String symbol to be convertedoutArray
- the double array where the one-of-N code one-of-N code
will be storedinx
- the int starting index where the one-of-N code should be
stored the output array- Returns:
- the index of the next available position in the output array
- Overrides:
- normalize in class Variable
getNormalizedSize
public int getNormalizedSize()
- Retrieves the number of discrete values the varible can take.
- Returns:
- the size of the one-of-N code when the variable is normalized
- Overrides:
- getNormalizedSize in class Variable
getDecodedValue
public java.lang.String getDecodedValue(double[] act,
int start)
- Retrieves the value of the given activation in a format that can be
displayed.
- Parameters:
act
- the double array that contains the activationstart
- the int starting index for the activation within the array- Returns:
- the value of the activation in a format that can be displayed
- Overrides:
- getDecodedValue in class Variable