(C++)  1.0.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
C45Algorithm.h
1 #ifndef GRAIL_C45_ALGORITHM_H
2 #define GRAIL_C45_ALGORITHM_H
3 
4 #include "../DT/DecisionNode.h"
5 #include "C45IterationParameters.h"
6 #include "C45ValueDecisionCounter.h"
7 #include "Dataset.hh"
8 #include <unordered_set>
9 #include <memory>
10 
11 namespace grail
12 {
13  namespace simulation
14  {
15  class ISimulatedGameAction;
16 
22  {
23  public:
30  std::unique_ptr<DecisionNode<ISimulatedGameAction>> ConstructTree(Dataset& dataset, int maxDepth = decisionTreeMaxDepth);
31 
35  const std::unordered_set<int>& GetUsedColumns() const;
36 
37  private:
38  void RunForContinuousColumn(size_t column, double globalEntropy, C45IterationParameters& params);
39  void RunForNominalColumn(size_t column, double globalEntropy, C45IterationParameters& params);
40  std::unique_ptr<DecisionNode<ISimulatedGameAction>> Iterate(C45IterationParameters params);
41  std::unique_ptr<DecisionNode<ISimulatedGameAction>> PerformSplit(C45IterationParameters& params, int bestColumnIndex);
42 
43  const ISimulatedGameAction* globalFrequentAction = nullptr;
44  std::unordered_set<int> usedColumns;
45  int maxDepth;
46  int currentDepth;
47 
48  };
49  }
50 }
51 
52 #endif //GRAIL_C45_ALGORITHM_H
This class encapsulates the C4.5 Algorithm used to generate a decision tree (see Grail....
Definition: C45Algorithm.h:22
const std::unordered_set< int > & GetUsedColumns() const
Gets indices of columns in the dataset used for learning with the C4.5 Algorithm that were actually u...
Definition: C45Algorithm.cpp:132
std::unique_ptr< DecisionNode< ISimulatedGameAction > > ConstructTree(Dataset &dataset, int maxDepth=decisionTreeMaxDepth)
Constructs a new decision tree based on the provided dataset. The decision type is given by generic a...
Definition: C45Algorithm.cpp:53
Definition: Dataset.hh:20
Base class for all actions in SimulatedGame. Derive from it for your actions.
Definition: ISimulatedGameAction.hh:41
The whole class should be INTERNAL; part of the private interface.
Definition: C45IterationParameters.h:13