Grail (C++)  1.2.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::simgames::learn::Dataset Class Reference

Public Member Functions

size_t DecisionVariablesCount () const
 Gets the number of measures (also know as considerations / decisions / columns in dataset). More...
 
const std::vector< dt::DTConsiderationType > & GetConsiderationTypes () const
 Gets types of the respective consideration, in order of appearance. The types are either NUMERIC or NOMINAL. More...
 
dt::DTConsiderationType GetConsiderationType (int columnIndex) const
 Returns the type of the i-th consideration; i = columnIndex. More...
 
 Dataset (std::initializer_list< dt::DTConsiderationType > considerationTypes)
 Creates a new dataset. More...
 
 Dataset (const std::vector< dt::DTConsiderationType > &considerationTypes)
 Creates a new dataset. More...
 
void AddSample (std::unique_ptr< ISimulatedGameAction > decision, std::initializer_list< float > data)
 Constructs and insert new sample to the dataset. The sample is constructed using the @decision and values for considerations (@data).
 
void AddSample (std::unique_ptr< ISimulatedGameAction > decision, const std::vector< float > &data)
 Constructs and insert new sample to the dataset. The sample is constructed using the @decision and values for considerations (@data).
 
void AddSample (std::unique_ptr< DatasetSample > sample)
 Insert new sample to the dataset.
 
double ValidateBinary (dt::DecisionNode< ISimulatedGameAction > &decisionTreeNodeRoot)
 Tests a decision tree (represented by the root node) against a dataset. Returns the accuracy of decision predictions vs. decisions that are in the dataset. More...
 
bool MoveFromOther (Dataset &sourceDataset)
 Moves samples from another dataset to the dataset this function was called on. It performs a basic check whether ConsiderationTypes are compatible between the two dataset. Warning: If succeeded, this will erase the sourceDataset. More...
 
bool CopyFromOther (Dataset &sourceDataset)
 Adds samples from another dataset to the dataset this function was called on. It performs a basic check whether ConsiderationTypes are compatible between the two dataset. More...
 

Public Attributes

std::vector< std::unique_ptr< DatasetSample > > Samples
 Data stored in Dataset. More...
 

Friends

class C45Algorithm
 

Constructor & Destructor Documentation

◆ Dataset() [1/2]

grail::simgames::learn::Dataset::Dataset ( std::initializer_list< dt::DTConsiderationType >  considerationTypes)

Creates a new dataset.

Parameters
considerationTypesData type {NUMERIC, NOMINAL} for the respective columns in the dataset.

◆ Dataset() [2/2]

grail::simgames::learn::Dataset::Dataset ( const std::vector< dt::DTConsiderationType > &  considerationTypes)

Creates a new dataset.

Parameters
considerationTypesData type {NUMERIC, NOMINAL} for the respective columns in the dataset.

Member Function Documentation

◆ CopyFromOther()

bool grail::simgames::learn::Dataset::CopyFromOther ( Dataset sourceDataset)

Adds samples from another dataset to the dataset this function was called on. It performs a basic check whether ConsiderationTypes are compatible between the two dataset.

Parameters
sourceDatasetThe dataset to copy samples from.
Returns
TRUE: if samples been succesfully added. FALSE: when ConsiderationTypes are incompatible and therefore the data have not been added.

◆ DecisionVariablesCount()

size_t grail::simgames::learn::Dataset::DecisionVariablesCount ( ) const

Gets the number of measures (also know as considerations / decisions / columns in dataset).

◆ GetConsiderationType()

dt::DTConsiderationType grail::simgames::learn::Dataset::GetConsiderationType ( int  columnIndex) const

Returns the type of the i-th consideration; i = columnIndex.

◆ GetConsiderationTypes()

const std::vector< dt::DTConsiderationType > & grail::simgames::learn::Dataset::GetConsiderationTypes ( ) const

Gets types of the respective consideration, in order of appearance. The types are either NUMERIC or NOMINAL.

◆ MoveFromOther()

bool grail::simgames::learn::Dataset::MoveFromOther ( Dataset sourceDataset)

Moves samples from another dataset to the dataset this function was called on. It performs a basic check whether ConsiderationTypes are compatible between the two dataset. Warning: If succeeded, this will erase the sourceDataset.

Parameters
sourceDatasetThe dataset to move samples from.
Returns
TRUE: if samples been succesfully moved. FALSE: when ConsiderationTypes are incompatible and therefore the data have not been moved.

◆ ValidateBinary()

double grail::simgames::learn::Dataset::ValidateBinary ( dt::DecisionNode< ISimulatedGameAction > &  decisionTreeNodeRoot)

Tests a decision tree (represented by the root node) against a dataset. Returns the accuracy of decision predictions vs. decisions that are in the dataset.

Returns
Prediction accuracy.

Member Data Documentation

◆ Samples

std::vector<std::unique_ptr<DatasetSample> > grail::simgames::learn::Dataset::Samples

Data stored in Dataset.


The documentation for this class was generated from the following files: