Grail (C#)  1.2.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType > Class Template Reference

Container for data in form of [consideration_values][decision], where consideration values are [float, float,...,float] and decision is TDecisionType. USe it for training the decision tree. More...

Public Member Functions

 Dataset (params DecisionConsiderationType[] considerationTypes)
 Creates a new dataset. More...
 
bool MoveFromOther (Dataset< TDecisionType > 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 (in Dataset< TDecisionType > 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...
 
double ValidateBinary (DecisionNode< TDecisionType > rootNode)
 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...
 
void WriteToFile (IDecisionStringSerializer< TDecisionType > decisionSerializer, StreamWriter writer)
 Use this method to serialize content of the Dataset to the file. More...
 
void ReadFromFile (IDecisionStringSerializer< TDecisionType > decisionSerializer, StreamReader reader)
 Use this method to read the Dataset content from a file. More...
 

Public Attributes

int DecisionVariablesCount => ConsiderationTypes.Length
 The number of measures (also know as considerations / decisions / columns in dataset). More...
 

Properties

DecisionConsiderationType [] ConsiderationTypes [get]
 Gets types of the respective consideration, in order of appearance. The types are either NUMERIC or NOMINAL. More...
 
List< DatasetSample< TDecisionType > > Samples [get]
 Data stored in Dataset. More...
 
DatasetSample< TDecisionType > this[int index] [get]
 

Detailed Description

Container for data in form of [consideration_values][decision], where consideration values are [float, float,...,float] and decision is TDecisionType. USe it for training the decision tree.

Template Parameters
TDecisionType

Constructor & Destructor Documentation

◆ Dataset()

Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.Dataset ( params DecisionConsiderationType []  considerationTypes)
inline

Creates a new dataset.

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

Member Function Documentation

◆ CopyFromOther()

bool Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.CopyFromOther ( in Dataset< TDecisionType >  sourceDataset)
inline

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.

◆ MoveFromOther()

bool Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.MoveFromOther ( Dataset< TDecisionType >  sourceDataset)
inline

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.

◆ ReadFromFile()

void Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.ReadFromFile ( IDecisionStringSerializer< TDecisionType >  decisionSerializer,
StreamReader  reader 
)
inline

Use this method to read the Dataset content from a file.

Parameters
decisionSerializerProvide instance of a class responsible for serialization of the decision type to string. The decision is in each dataset sample.
readerA standard .NET StreamReader object

◆ ValidateBinary()

double Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.ValidateBinary ( DecisionNode< TDecisionType >  rootNode)
inline

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.

◆ WriteToFile()

void Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.WriteToFile ( IDecisionStringSerializer< TDecisionType >  decisionSerializer,
StreamWriter  writer 
)
inline

Use this method to serialize content of the Dataset to the file.

Parameters
decisionSerializerProvide instance of a class responsible for serialization of the decision type to string. The decision is in each dataset sample.
writerA standard .NET StreamWriter object

Member Data Documentation

◆ DecisionVariablesCount

int Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.DecisionVariablesCount => ConsiderationTypes.Length

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

Property Documentation

◆ ConsiderationTypes

DecisionConsiderationType [] Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.ConsiderationTypes
get

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

◆ Samples

List<DatasetSample<TDecisionType> > Grail.SimulatedGames.OfflineLearning.Dataset< TDecisionType >.Samples
get

Data stored in Dataset.


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