Grail (C++)  1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::simulation::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< DTConsiderationType > & GetConsiderationTypes () const
 Gets types of the respective consideration, in order of appearance. The types are either NUMERIC or NOMINAL. More...
 
DTConsiderationType GetConsiderationType (int columnIndex) const
 Returns the type of the i-th consideration; i = columnIndex. More...
 
 Dataset (std::initializer_list< DTConsiderationType > considerationTypes)
 Creates a new dataset. More...
 
 Dataset (const std::vector< 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 (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::simulation::Dataset::Dataset ( std::initializer_list< DTConsiderationType >  considerationTypes)

Creates a new dataset.

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

◆ Dataset() [2/2]

grail::simulation::Dataset::Dataset ( const std::vector< DTConsiderationType > &  considerationTypes)

Creates a new dataset.

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

Member Function Documentation

◆ CopyFromOther()

bool grail::simulation::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::simulation::Dataset::DecisionVariablesCount ( ) const

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

◆ GetConsiderationType()

DTConsiderationType grail::simulation::Dataset::GetConsiderationType ( int  columnIndex) const

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

◆ GetConsiderationTypes()

const std::vector< DTConsiderationType > & grail::simulation::Dataset::GetConsiderationTypes ( ) const

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

◆ MoveFromOther()

bool grail::simulation::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::simulation::Dataset::ValidateBinary ( 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::simulation::Dataset::Samples

Data stored in Dataset.


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