Class: Dataset

Dataset

For representing a dataset.

Constructor

new Dataset()

Source:

Members

attributes :Array.<Attribute>

The Attributes which describe the records within the dataset.
Type:
Source:

name :String

The name of the dataset. For example, "adult" or "Breast Cancer". (These are the names of two popular datasets.)
Type:
  • String
Source:

records :Array.<Records>

The records which make up the dataset.
Type:
  • Array.<Records>
Source:

Methods

add_attribute(attribute)

Adds the passed attribute to the dataset.
Parameters:
Name Type Description
attribute Attribute The attribute to add.
Source:

add_record(record)

Adds the passed record to the dataset.
Parameters:
Name Type Description
record Record The record to add.
Source:

all_attribute_values(attribute) → {Array.<Value>}

Returns an array of all record values for the requested attribute.
Parameters:
Name Type Description
attribute Attribute The attribute to get the record values of.
Source:
Returns:
An array of all record values for the requested attribute.
Type
Array.<Value>

get_attribute(index) → {Attribute}

Returns the attribute from the dataset at the passed index.
Parameters:
Name Type Description
index Number The index of the attribute to get.
Source:
Returns:
The attribute at the requested index.
Type
Attribute

get_name() → {String}

Gets the name of the Dataset object.
Source:
Returns:
The name of this Dataset object.
Type
String

get_num_attributes() → {Number}

Returns the number of attributes in the dataset.
Source:
Returns:
The number of attributes in the dataset.
Type
Number

get_num_records() → {Number}

Returns the number of records in the dataset.
Source:
Returns:
The number of records in the dataset.
Type
Number

get_record(index) → {Record}

Returns the record from the dataset at the passed index.
Parameters:
Name Type Description
index Number The index of the record to get.
Source:
Returns:
The record at the requested index.
Type
Record

index_of_attribute(attribute) → {Number}

Returns the index of the requested Attribute object. (-1 if not found)
Parameters:
Name Type Description
attribute Attribute The attribute to find the index of.
Source:
Returns:
The index (-1 if not found).
Type
Number

set_name(name)

Sets the name of the dataset.
Parameters:
Name Type Description
name String the new name for this dataset.
Source: