SMILE.NET 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.

Contents

[edit] Interfaces

  • IDisposable

The .NET garbage collector automatically releases the memory allocated to objects when they are no longer used. It is, however, unpredictable when garbage collection will occur. Furthermore, the garbage collector has no knowledge of unmanaged resources such as the DSL_dataset C++ object wrapped by Dataset. The IDisposable.Dispose() method provides means to ensure that wrapped object is deleted before garbage collection occurs:

  DataSet dataSet = new DataSet();
  try {
    // use dataSet here
  }
  finally {
    if (dataSet != null) dataSet.Dispose();
  }

C# has the using statement, which is equivalent to the try/finally/Dispose construct in the preceding example:

  using (DataSet dataSet = new DataSet()) {
    // use dataSet here
  }


[edit] Constants

  • const float DefaultMissingFloat

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


  • const int DefaultMissingInt

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


[edit] Properties

  • int RecordCount (get)

The number of records.


  • int VariableCount (get)

The number of variables.


[edit] Methods

  • 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 SetNodeHandle(int variable, int handle)

Sets the handle of the variable. This method throws a SmileException when an invalid variable index or handle 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.

Personal tools