NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
FgDiscreteFactorNode.h
1
11#pragma once
12
13#include <MachineLearning/FgIFactorNode.h>
14#include <MachineLearning/FgDiscreteVariableNode.h>
15//#include <MachineLearning/FgPotential.h>
16#include <MachineLearning/FgIMessage.h>
17
18namespace NeuralEngine
19{
20 namespace MachineLearning
21 {
31 class NE_IMPEXP DiscreteFactorNode : public IFactorNode
32 {
33 public:
34
44 DiscreteFactorNode(DiscreteVariableNode &node, std::string name);
45
55
64 DiscreteFactorNode(std::vector<DiscreteVariableNode*> nodes, std::string name);
65
73 DiscreteFactorNode(std::vector<DiscreteVariableNode*> nodes);
74
81
91 virtual bool IsSupported(MsgType type);
92
101 void SetPotential(double potential, int index);
102
110 void AddPotential(double potential);
111
121 double GetPotential(int index);
122
123 //virtual void Summation();
124 protected:
139 virtual IMessage ComputeMessage(std::string toNodeName, MsgBox &neededMessages);
140
141 private:
142 //Potential p;
143 std::vector<double> vP; // flattend version of an D dimensional propability table.
144
145 friend class boost::serialization::access;
146
147 template<class Archive>
148 void serialize(Archive& ar, unsigned int version)
149 {
150 ar & boost::serialization::base_object<IFactorNode>(*this);
151 ar& BOOST_SERIALIZATION_NVP(vP);
152 }
153 };
154 }
155}
DiscreteFactorNode(std::vector< DiscreteVariableNode * > nodes)
Constructor.
void AddPotential(double potential)
Adds a potential.
void SetPotential(double potential, int index)
Sets a potential at given index.
virtual bool IsSupported(MsgType type)
Query if message type is supported.
virtual IMessage ComputeMessage(std::string toNodeName, MsgBox &neededMessages)
Calculate a message to connectd node.
DiscreteFactorNode(DiscreteVariableNode &node, std::string name)
Default constructor.
double GetPotential(int index)
Gets a potential.
DiscreteFactorNode(DiscreteVariableNode &node)
Constructor.
DiscreteFactorNode(std::vector< DiscreteVariableNode * > nodes, std::string name)
Constructor.