Class DataSet
The DataSet class. This class represents a data set as a "matrix" with cases as rows and variables as columns.
Note: Return and argument types for methods in this class vary depending on the particular API DLL (x86/x64 platform, single/double precision) being used. Please read the section Using the Hugin C#/.NET Core/.NET 5/.NET 6 API.
Inherited Members
Namespace: HAPI
Assembly: hugincs-9.7-netstandard2.0-x64.dll
Syntax
public class DataSet
Constructors
DataSet()
Constructs a new (empty) DataSet.
Declaration
public DataSet()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
DataSet(string, char, ParseListener)
Constructs a DataSet from a CSV specification provided in a file or as a string. Instead of a comma, a different separator character may be used.
Declaration
public DataSet(string csvStringOrFileName, char separator, ParseListener parseListener)
Parameters
| Type | Name | Description |
|---|---|---|
| string | csvStringOrFileName | A string containing a CSV specification or the name of a CSV file |
| char | separator | The separator character (must not be a space or a double-quote character) |
| ParseListener | parseListener | The ParseListener used for handling parse errors. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
Methods
ComputeIEMIntervals(ulong, ulong)
Creates a discretization of the numeric data in the
specified column. The supervised discretization algorithm
by Fayyad and Irani is used to create intervals for the
numeric data in the column with index valueColumn. The class
data used to guide the discretization is contained in the
column with index classColumn.
Declaration
public double[] ComputeIEMIntervals(ulong valueColumn, ulong classColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | valueColumn | The index of the column to discretize. |
| ulong | classColumn | The index of the column containing the class (or target) data. |
Returns
| Type | Description |
|---|---|
| double[] | A list of real numbers (suitable for use as state values for an interval node) |
Remarks
Generic declaration:
public double[] ComputeIEMIntervals (size_t valueColumn, size_t classColumn)
Delete()
Deletes this DataSet.
Declaration
public void Delete()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
DeleteColumn(ulong)
Deletes the specified column from this DataSet.
Declaration
public void DeleteColumn(ulong column)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | column | The index of the column to be deleted. |
Remarks
Generic declaration:
public void DeleteColumn (size_t column)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
DeleteRow(ulong)
Deletes the specified row from this DataSet.
Declaration
public void DeleteRow(ulong row)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | row | The index of the row to be deleted. |
Remarks
Generic declaration:
public void DeleteRow (size_t row)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetColumnName(ulong)
Returns the name of the specified column of this DataSet.
Declaration
public string GetColumnName(ulong column)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | column | The index of the column. |
Returns
| Type | Description |
|---|---|
| string | The name of the specified column. |
Remarks
Generic declaration:
public String GetColumnName (size_t column)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetDataItem(ulong, ulong)
Returns the data item at the specified location of this DataSet.
Declaration
public string GetDataItem(ulong row, ulong column)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | row | The index of the row. |
| ulong | column | The index of the column. |
Returns
| Type | Description |
|---|---|
| string | The data item at the specified location. |
Remarks
Generic declaration:
public String GetDataItem (size_t row, size_t column)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetNumberOfColumns()
Returns the number of columns in this DataSet.
Declaration
public ulong GetNumberOfColumns()
Returns
| Type | Description |
|---|---|
| ulong | The number of columns |
Remarks
Generic declaration:
public size_t GetNumberOfColumns ()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetNumberOfRows()
Returns the number of rows in this DataSet.
Declaration
public ulong GetNumberOfRows()
Returns
| Type | Description |
|---|---|
| ulong | The number of rows. |
Remarks
Generic declaration:
public size_t GetNumberOfRows ()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetUserData()
Returns the value stored within the user data slot of this DataSet.
Declaration
public object GetUserData()
Returns
| Type | Description |
|---|---|
| object | The user data Object associated with this DataSet. |
Remarks
Returns the value stored within the user data slot of this
DataSet. If the stored value is null, or if no
value has been stored, null is returned. It is the
responsibility of the application programmer to ensure
that the data is valid. Also note that when you delete a
dataset, Hugin does not attempt to delete the Object
referenced by the user data slot. It is the responsibility
of the user.
IsAlive()
Is this DataSet object alive?
Declaration
public bool IsAlive()
Returns
| Type | Description |
|---|---|
| bool |
MoveColumn(ulong, ulong)
Moves the specified column to a new position. The columns between the old and the new column positions will be shifted one position to the left or to the right depending on the direction of the move.
Declaration
public void MoveColumn(ulong column, ulong newColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | column | The index of the column to be moved. |
| ulong | newColumn | The index of the destination column. |
Remarks
Generic declaration:
public void MoveColumn (size_t column, size_t newColumn)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
MoveRow(ulong, ulong)
Moves the specified row to a new position. The rows between the old and the new row positions will be shifted one position to the left or to the right depending on the direction of the move.
Declaration
public void MoveRow(ulong row, ulong newRow)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | row | The index of the row to be moved. |
| ulong | newRow | The index of the destination row. |
Remarks
Generic declaration:
public void MoveRow (size_t row, size_t newRow)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
NewColumn(string)
Creates a new column in this DataSet.
Declaration
public ulong NewColumn(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the new column. |
Returns
| Type | Description |
|---|---|
| ulong | The index of the new column. |
Remarks
Generic declaration:
public size_t NewColumn (String name)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
NewRow()
Creates a new row in this DataSet.
Declaration
public ulong NewRow()
Returns
| Type | Description |
|---|---|
| ulong | The index of the new row. |
Remarks
Generic declaration:
public size_t NewRow ()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SaveAsCSV(string, char)
Saves this DataSet in the format of a comma-separated-values (CSV) file. However, another delimiter than a comma may be used.
Declaration
public void SaveAsCSV(string fileName, char delimiter)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The name of the file in which to store the data. |
| char | delimiter | The delimiter character (must not be a double-quote character). |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetColumnName(ulong, string)
Sets the name of the specified column of this DataSet.
Declaration
public void SetColumnName(ulong column, string name)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | column | The index of the column. |
| string | name | The new name of the column. |
Remarks
Generic declaration:
public void SetColumnName (size_t column, String name)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetDataItem(ulong, ulong, string)
Sets (or deletes) the data item at the specified location of this DataSet.
Declaration
public void SetDataItem(ulong row, ulong column, string data)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | row | The index of the row. |
| ulong | column | The index of the column. |
| string | data | The new data item (a |
Remarks
Generic declaration:
public void SetDataItem (size_t row, size_t column, String data)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetUserData(object)
Sets the user data field of this DataSet.
Declaration
public void SetUserData(object data)
Parameters
| Type | Name | Description |
|---|---|---|
| object | data | An Object, the user-defined data associated with this DataSet. |
Remarks
Sets the user data field of this DataSet. The Hugin API provides a slot within each Dataset for use exclusively by the user/application. This slot can hold an instance of type Object, such as a String, a List{T}, etc. Please note that Hugin does not do anything to the user data. Data is not even copied. Only a reference to the data is stored.
ToCSVString(char)
Creates a CSV representation of this DataSet.
Declaration
public string ToCSVString(char delimiter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | delimiter | The delimiter character (must not be a double-quote character). |
Returns
| Type | Description |
|---|---|
| string | A string containing the CSV representation. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |