NeuralEngine A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes. |

FgGPNode.h
1
11#pragma once
12
13#include <NeMachineLearningLib.h>
14#include <MachineLearning/FgArrayFireSerialization.h>
15#include <boost/serialization/shared_ptr.hpp>
16#include <vector>
17#include <memory>
18
19 namespace NeuralEngine
20{
21 namespace MachineLearning
22 {
23 namespace GPModels
24 {
25 namespace AEP
26 {
27 template<typename Scalar>
28 class SDGPLVM;
29
30 template<typename Scalar>
31 class SGPLVM;
32 }
33 }
34
40 template<typename Scalar>
41 class NE_IMPEXP GPNode
42 {
43 public:
44
50 GPNode();
51
57 virtual ~GPNode();
58
73 int GetNumChildren() const;
74
117 int AttachChild(std::shared_ptr<GPNode<Scalar>> const& child);
118
134 int DetachChild(std::shared_ptr<GPNode<Scalar>> const& child);
135
151 std::shared_ptr<GPNode<Scalar>> DetachChildAt(int i);
152
158 void DetachAllChildren();
159
178 std::shared_ptr<GPNode<Scalar>> SetChild(int i,
179 std::shared_ptr<GPNode<Scalar>> const& child);
180
181
198 std::shared_ptr<GPNode<Scalar>> GetChild(int i);
199
210 GPNode<Scalar>* GetParent();
211
221 void SetParent(GPNode<Scalar>* parent);
222
223 protected:
224 // Child pointers.
225 std::vector<std::shared_ptr<GPNode<Scalar>>> mChild;
226 GPNode<Scalar>* mParent;
227 private:
228 friend class boost::serialization::access;
229 friend class GPModels::AEP::SDGPLVM<Scalar>;
230 friend class GPModels::AEP::SGPLVM<Scalar>;
231
232 template<class Archive>
233 void serialize(Archive& ar, unsigned int version)
234 {
235 //ar& boost::serialization::base_object<GPLVMBaseModel<Scalar>>(*this);
236
237 ar.register_type<GPModels::AEP::SDGPLVM<Scalar>>();
238 ar.register_type<GPModels::AEP::SGPLVM<Scalar>>();
239
240 ar& BOOST_SERIALIZATION_NVP(mParent);
241 ar& BOOST_SERIALIZATION_NVP(mChild);
242 }
243
244 };
245 }
246}
NeuralEngine::MachineLearning::GPModels::AEP::SDGPLVM
Sparse deep GPLVM via Approximated Expectation Propagation (AEP).
Definition: FgAEPSparseDGPLVM.h:67
NeuralEngine::MachineLearning::GPModels::AEP::SGPLVM
Sparse GPLVM via Approximated Expectation Propagation (AEP).
Definition: FgAEPSparseGPLVM.h:67
NeuralEngine::MachineLearning::GPNode
This class represents grouping nodes in a hiearchy.
Definition: FgGPNode.h:42
NeuralEngine::MachineLearning::GPNode::GetNumChildren
int GetNumChildren() const
Gets the number of children of this item.
NeuralEngine::MachineLearning::GPNode::DetachChild
int DetachChild(std::shared_ptr< GPNode< Scalar > > const &child)
Detaches a child.
NeuralEngine::MachineLearning::GPNode::GPNode
GPNode()
Default constructor.
NeuralEngine::MachineLearning::GPNode::GetChild
std::shared_ptr< GPNode< Scalar > > GetChild(int i)
Gets a child at index.
NeuralEngine::MachineLearning::GPNode::SetParent
void SetParent(GPNode< Scalar > *parent)
Access to the parent object. Node calls this during attach/detach of children.
NeuralEngine::MachineLearning::GPNode::SetChild
std::shared_ptr< GPNode< Scalar > > SetChild(int i, std::shared_ptr< GPNode< Scalar > > const &child)
Sets a child.
NeuralEngine::MachineLearning::GPNode::GetParent
GPNode< Scalar > * GetParent()
Access to the parent object, which is null for the root of the hierarchy.
NeuralEngine::MachineLearning::GPNode::DetachAllChildren
void DetachAllChildren()
Detach all children from this node.
NeuralEngine::MachineLearning::GPNode::DetachChildAt
std::shared_ptr< GPNode< Scalar > > DetachChildAt(int i)
Detaches a child at index.
NeuralEngine::MachineLearning::GPNode::AttachChild
int AttachChild(std::shared_ptr< GPNode< Scalar > > const &child)
Attaches a child.
NeuralEngine::MachineLearning::GPNode::~GPNode
virtual ~GPNode()
Destructor.
Scalar
NeuralEngine
Definition: NeArray2.h:18