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

Used to serialize decision tree in a text mode into array of strings. Pass object of this type to the DecisionTree.Serialize method. More...

#include <DecisionTreeStringListSerializer.hh>

Inheritance diagram for grail::simulation::DecisionTreeStringListSerializer< TDecisionType >:
Collaboration diagram for grail::simulation::DecisionTreeStringListSerializer< TDecisionType >:

Public Member Functions

 DecisionTreeStringListSerializer (std::unique_ptr< IDecisionStringSerializer< TDecisionType >> actionSerializer)
 Constructs a new DecisionTreeBinarySerializer object. More...
 
const std::vector< std::string > & GetSerializedStrings () const
 This serializer stores serialized data internally. You can access it using this method. More...
 
void SetSerializedStrings (std::vector< std::string > &data)
 Use this method if you want to deserialize a decision tree. Pass the serialized representation of a decision tree and then call the DecisionTree.Deserialize() method. More...
 
void Clear ()
 Initializes the serializer by setting the read/write position to 0 More...
 
void Print ()
 Prints the dataset to the standard output. More...
 
virtual void SerializeNodeType (DecisionNodeType nodeType) override
 
virtual DecisionNodeType DeserializeNodeType () override
 
virtual void SerializeColumnIndex (int columnIndex) override
 
virtual int DeserializeColumnIndex () override
 
virtual void SerializeValue (float value) override
 
virtual float DeserializeValue () override
 
virtual void SerializeChildrenCount (int count) override
 
virtual int DeserializeChildrenCount () override
 
virtual void SerializeDecision (const TDecisionType &decision) override
 
virtual std::unique_ptr< TDecisionType > DeserializeDecision () override
 
virtual void WriteToFile (const std::string &filename)
 
virtual void ReadFromFile (const std::string &filename)
 
- Public Member Functions inherited from grail::simulation::IDecisionTreeSerializer< TDecisionType >
virtual void Initialize ()
 
void Serialize (DecisionNode< TDecisionType > &node)
 
void SerializeContinuousInnerDecisionNode (ContinuousInnerDecisionNode< TDecisionType > &node)
 
void SerializeNominalInnerDecisionNode (NominalInnerDecisionNode< TDecisionType > &node)
 
void SerializeLeafNode (LeafDecisionNode< TDecisionType > &node)
 
void DeserializeContinuousInnerDecisionNode (ContinuousInnerDecisionNode< TDecisionType > &node)
 
void DeserializeNominalInnerDecisionNode (NominalInnerDecisionNode< TDecisionType > &node)
 
std::unique_ptr< DecisionNode< TDecisionType > > DeserializeNode ()
 

Detailed Description

template<class TDecisionType>
class grail::simulation::DecisionTreeStringListSerializer< TDecisionType >

Used to serialize decision tree in a text mode into array of strings. Pass object of this type to the DecisionTree.Serialize method.

Constructor & Destructor Documentation

◆ DecisionTreeStringListSerializer()

template<class TDecisionType >
grail::simulation::DecisionTreeStringListSerializer< TDecisionType >::DecisionTreeStringListSerializer ( std::unique_ptr< IDecisionStringSerializer< TDecisionType >>  actionSerializer)
inline

Constructs a new DecisionTreeBinarySerializer object.

Parameters
actionSerializerThe object that performs to-string serialization of actions.

Member Function Documentation

◆ Clear()

template<class TDecisionType >
void grail::simulation::DecisionTreeStringListSerializer< TDecisionType >::Clear ( )
inline

Initializes the serializer by setting the read/write position to 0

◆ GetSerializedStrings()

template<class TDecisionType >
const std::vector<std::string>& grail::simulation::DecisionTreeStringListSerializer< TDecisionType >::GetSerializedStrings ( ) const
inline

This serializer stores serialized data internally. You can access it using this method.

Returns
Serialized decision tree as array of strings.

◆ Print()

template<class TDecisionType >
void grail::simulation::DecisionTreeStringListSerializer< TDecisionType >::Print ( )
inline

Prints the dataset to the standard output.

◆ SetSerializedStrings()

template<class TDecisionType >
void grail::simulation::DecisionTreeStringListSerializer< TDecisionType >::SetSerializedStrings ( std::vector< std::string > &  data)
inline

Use this method if you want to deserialize a decision tree. Pass the serialized representation of a decision tree and then call the DecisionTree.Deserialize() method.

Parameters
newList

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