Grail (C++)  1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::simulation::DecisionTree Class Reference

The main class encapsulating the decision tree algorithm. More...

#include <DecisionTree.hh>

Inheritance diagram for grail::simulation::DecisionTree:
Collaboration diagram for grail::simulation::DecisionTree:

Public Member Functions

 DecisionTree (std::unique_ptr< IVectorizer > vectorizer)
 Constructs a new decision tree object. You have to specify a proper vectorizer object that will be used to calculate values used by considerations (conditions) for the nodes.
 
void Print ()
 Prints the decision tree in a very diagnostic fashion onto standard output (cout).
 
void Serialize (IDecisionTreeSerializer< ISimulatedGameAction > &serializer) const
 Serializes the content of the tree into the passed serializer object.
 
void Deserialize (IDecisionTreeSerializer< ISimulatedGameAction > &serializer)
 Populates the tree based on the given serializer.
 
void Construct (Dataset &dataset, int maxDepth=decisionTreeMaxDepth)
 Runs the decision tree construction algorithm (C45). @dataset contains the training data. @maxDepth is The maximum number of nodes deep in the tree. Unless you are out of memory, it is advised to keep the depth relatively unlimited.
 
virtual std::unique_ptr< ISimulatedGameActionGetAction () const override
 Inherited via SimulatedGameHeuristic.
 
virtual bool IsHeuristicSituation (const ISimulatedGameUnit &unit) const override final
 Inherited via SimulatedGameHeuristic.
 
void SetColumnName (int columnIndex, const std::string &name)
 This will make the Print() function output the name instead of Column[columnIndex]. This name does not affect anything else.
 
void SetColumnNames (const std::initializer_list< std::string > &consecutiveNames)
 This will make the Print() function output the names instead of Column[columnIndex]. This name does not affect anything else.
 
 DecisionTree (const DecisionTree &other)=delete
 
IVectorizerGetVectorizer () const
 Returns the reference to the currently used vectorizer by the DecisionTree. Do not use this method, if you have not assigned any.
 
void SetVectorizer (std::unique_ptr< IVectorizer > vectorizer)
 Moves the vectorizer passed as parameter to the DecisionTree. The DecisionTree uses it to provide action via GetAction().
 

Detailed Description

The main class encapsulating the decision tree algorithm.


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