learn
Class DataSet

java.lang.Object
  |
  +--learn.DataSet

public class DataSet
extends java.lang.Object
implements java.io.Serializable

The DataSet class is used to load data from text files into memory for use in training or testing.

See Also:
Serialized Form

Field Summary
protected  boolean allNumericData
           
protected  java.util.Vector data
           
protected  java.util.Vector fieldList
           
protected  int fieldsPerRec
           
protected  java.lang.String fileName
           
protected  java.lang.String name
           
protected  java.util.Vector normalizedData
           
protected  int normFieldsPerRec
           
protected  int numRecords
           
 javax.swing.JTextArea textArea1
           
protected  java.util.Hashtable variableList
           
 
Constructor Summary
DataSet(java.lang.String name, java.lang.String fileName)
          Creates a dataset with the given name that will be populated from the specified file.
 
Method Summary
 void addVariable(Variable var)
          Adds a variable to the list of fields in the record.
 void displayNormalizedData()
          Displays the normalized data.
 void displayVariables()
          Displays all variables and their values.
 int getClassFieldSize()
          Retrieves the size of the class field.
 java.lang.String getClassFieldValue(double[] activations, int index)
          Retrieves the class field value for a given activation.
 java.lang.String getClassFieldValue(int recIndex)
          Retrieves the class field value for the given record index.
 int getFieldsPerRec()
          Method getFieldsPerRec
 java.lang.String getFileName()
          Method getFileName
 java.util.Vector getNormalizedData()
          Method getNormalizedData
 int getNormalizedRecordSize()
          Computes the record size after each variablel in the record is normalized.
 int getNormFieldsPerRec()
          Method getNormFieldsPerRec
 int getNumRecords()
          Method getNumRecords
 void loadDataFile()
          Reads the data from the file defined by the data file definition.
 void loadDataFileDefinition()
          Reads the data file definition which is a simple text files that contains a list of the field data types and their names.
 void normalizeData()
          Normalizes a record by translating discrete data to a one-of-N vector and by scaling all continuous data to be in the 0.0 to 1.0 range.
 void setDisplay(javax.swing.JTextArea textArea)
          Sets the text area to be displayed for the dataset information.
 void trace(java.lang.String text)
          Adds text to the text area for display.
 
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

fileName

protected java.lang.String fileName

allNumericData

protected boolean allNumericData

data

protected java.util.Vector data

normalizedData

protected java.util.Vector normalizedData

variableList

protected java.util.Hashtable variableList

fieldList

protected java.util.Vector fieldList

fieldsPerRec

protected int fieldsPerRec

normFieldsPerRec

protected int normFieldsPerRec

numRecords

protected int numRecords

textArea1

public transient javax.swing.JTextArea textArea1
Constructor Detail

DataSet

public DataSet(java.lang.String name,
               java.lang.String fileName)
Creates a dataset with the given name that will be populated from the specified file.
Parameters:
name - the String that contains the name of the dataset
fileName - the text file from which the dataset is populated
Method Detail

trace

public void trace(java.lang.String text)
Adds text to the text area for display.
Parameters:
text - the String to be displayed

setDisplay

public void setDisplay(javax.swing.JTextArea textArea)
Sets the text area to be displayed for the dataset information.
Parameters:
textArea - the JTextArea text area to be displayed

displayVariables

public void displayVariables()
Displays all variables and their values.

getNumRecords

public int getNumRecords()
Method getNumRecords
Returns:
the int

getFieldsPerRec

public int getFieldsPerRec()
Method getFieldsPerRec
Returns:
the int

getNormFieldsPerRec

public int getNormFieldsPerRec()
Method getNormFieldsPerRec
Returns:
the int

getNormalizedData

public java.util.Vector getNormalizedData()
Method getNormalizedData
Returns:
the Vector

getFileName

public java.lang.String getFileName()
Method getFileName
Returns:
the String

loadDataFileDefinition

public void loadDataFileDefinition()
Reads the data file definition which is a simple text files that contains a list of the field data types and their names.

getClassFieldSize

public int getClassFieldSize()
Retrieves the size of the class field.
Returns:
the class field size

loadDataFile

public void loadDataFile()
Reads the data from the file defined by the data file definition.

addVariable

public void addVariable(Variable var)
Adds a variable to the list of fields in the record.
Parameters:
var - the Variable object to be added to the list

getNormalizedRecordSize

public int getNormalizedRecordSize()
Computes the record size after each variablel in the record is normalized.
Returns:
the normalized record size

getClassFieldValue

public java.lang.String getClassFieldValue(int recIndex)
Retrieves the class field value for the given record index.
Parameters:
recIndex - the int record index
Returns:
the class field value

getClassFieldValue

public java.lang.String getClassFieldValue(double[] activations,
                                           int index)
Retrieves the class field value for a given activation.
Parameters:
activations - the double array of activations from which the class field value is retrieved
index - the starting index of the output unit
Returns:
the class field value

normalizeData

public void normalizeData()
Normalizes a record by translating discrete data to a one-of-N vector and by scaling all continuous data to be in the 0.0 to 1.0 range.

displayNormalizedData

public void displayNormalizedData()
Displays the normalized data.