JSMILE Learning: Dataset

From DSL
Jump to: navigation, search

This class holds data that can be used for learning. All learning algorithms take a data set as input.

Constants

  • static final float DefaultMissingFloat

The default value for a missing value in case of a continuous variable.


  • static final int DefaultMissingInt

The default value for a missing value in case of a discrete variable.


Methods

  • int getRecordCount()

The number of records.


  • int getVariableCount()

The number of variables.


  • void addEmptyRecord()

Adds an empty record to the data set. The record will contain missing value markers.


  • void addFloatVariable(String id)

Adds a continuous variable to the data set. This method used DefaultMissingFloat as missing value marker.


  • void addFloatVariable(String id, float missingValue)

Adds a continuous variable to the data set and specify the value that indicates a missing value.


  • void addIntVariable(String id)

Adds a discrete variable to the data set. This method used DefaultMissingInt as missing value marker.


  • void addIntVariable(String id, int missingValue)

Adds a discrete variable to the data set and specify the value that indicates a missing value.


  • float getFloat(int variable, int record)

Returns the corresponding continuous element in the data set. This method throws a SmileException when an invalid variable or record index is passed.


  • int getInt(int variable, int record)

Returns the corresponding discrete element in the data set. This method throws a SmileException when an invalid variable or record index is passed.


  • int getNodeHandle(int variable)

Returns the handle of the variable. This method throws a SmileException when an invalid variable index is passed.


  • String[] getStateNames(int variable)

Returns the state names of the variable. This method throws a SmileException when an invalid variable index is passed.


  • String getVariableId(int variable)

Returns the id of the variable. This method throws a SmileException when an invalid variable index is passed.


  • void setFloat(int variable, int record, float value)

Sets the corresponding continuous element to a new value. This method throws a SmileException when an invalid variable or record index is passed.


  • void setInt(int variable, int record, int value)

Sets the corresponding discrete element to a new value. This method throws a SmileException when an invalid variable or record index is passed.


  • void setStateNames(int variable, String[] names)

Sets the state names of a variable. This method throws a SmileException when an invalid variable index is passed.


  • double[] discretize(int variable, int algorithm, int intervals, String statePrefix);

The arguments are:

1) variable: 0-based column index

2) algorithm: algorithm IDs are defined in DataSet.DiscretizationAlgorithmType

3) intervals: number of discretization bins

4) statePrefix: prefix for the generated state names; pass null or empty string to skip state name generation

The return value is the array containing the bin edges, the length of the returned array is intervals - 1.

Personal tools