learn
Class Variable

java.lang.Object
  |
  +--learn.Variable
Direct Known Subclasses:
ContinuousVariable, DiscreteVariable

public abstract class Variable
extends java.lang.Object
implements java.io.Serializable

The Variable abstract class provides the common support necessary for continuous, numeric discrete, and categorical variables.

See Also:
Serialized Form

Field Summary
protected  int column
           
protected  java.util.Vector labels
           
protected  java.lang.String name
           
protected  java.lang.String value
           
 
Constructor Summary
Variable()
          Creates a Variable.
Variable(java.lang.String name)
          Creates a Variable with the given name.
 
Method Summary
abstract  void computeStatistics(java.lang.String inValue)
          Computes the minimum and maximum values for this variable based on the given string, but can also be used to compute other statistics as well.
 java.lang.String getDecodedValue(double[] act, int index)
          Method getDecodedValue
 int getIndex(java.lang.String label)
          Retrieves the index for the given label.
 java.lang.String getLabel(int index)
          Retrieves the label with the specified index.
 java.lang.String getLabels()
          Retrieves all the labels from a categorical variable.
 java.lang.String getName()
          Retrieves the name of the variable.
 int getNormalizedSize()
          Retrieves the normalized size of this variable.
 java.lang.String getValue()
          Retrieves the value of the variable.
 boolean isCategorical()
          Determines if the variable is categorical.
abstract  int normalize(java.lang.String inValue, double[] outArray, int inx)
          Converts the given symbol for use in the network.
 void setColumn(int col)
          Sets the column.
 void setLabels(java.lang.String Labels)
          Sets the labels using the given label string.
 void setValue(java.lang.String val)
          Sets the value of the variable.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

value

protected java.lang.String value

column

protected int column

labels

protected java.util.Vector labels
Constructor Detail

Variable

public Variable()
Creates a Variable.

Variable

public Variable(java.lang.String name)
Creates a Variable with the given name.
Parameters:
name - the String that contains the name of the variable
Method Detail

getName

public java.lang.String getName()
Retrieves the name of the variable.
Returns:
the name of the variable

setValue

public void setValue(java.lang.String val)
Sets the value of the variable.
Parameters:
val - the String value of the variable

getValue

public java.lang.String getValue()
Retrieves the value of the variable.
Returns:
the value of the variable

setLabels

public void setLabels(java.lang.String Labels)
Sets the labels using the given label string.
Parameters:
labels - the String that contains the labels for a categorical variable
Labels - the String

getLabel

public java.lang.String getLabel(int index)
Retrieves the label with the specified index.
Parameters:
index - the integer index of the desired label
Returns:
the label at the given index

getLabels

public java.lang.String getLabels()
Retrieves all the labels from a categorical variable.
Returns:
a string that contains all the labels, separated by spaces

getIndex

public int getIndex(java.lang.String label)
Retrieves the index for the given label.
Parameters:
label - the String for which the index is retrieved
Returns:
the index of the given label, -1 if label was not found

isCategorical

public boolean isCategorical()
Determines if the variable is categorical. return true if the variable is categorical. Otherwise, returns false
Returns:
the boolean

setColumn

public void setColumn(int col)
Sets the column.
Parameters:
col - the integer value of the column

computeStatistics

public abstract void computeStatistics(java.lang.String inValue)
Computes the minimum and maximum values for this variable based on the given string, but can also be used to compute other statistics as well.
Parameters:
inValue - the String on which the statistics are based

normalize

public abstract int normalize(java.lang.String inValue,
                              double[] outArray,
                              int inx)
Converts the given symbol for use in the network.
Parameters:
inValue - the String to be converted
outArray - the double array of converted values
inx - the integer index that indicates where the converted output is to be stored in the array
Returns:
the index of the next element in the array

getNormalizedSize

public int getNormalizedSize()
Retrieves the normalized size of this variable.
Returns:
the normalized size

getDecodedValue

public java.lang.String getDecodedValue(double[] act,
                                        int index)
Method getDecodedValue
Parameters:
act - the double[]
index - the int
Returns:
the String