Begin Network build

This commit is contained in:
2023-06-29 22:00:41 +02:00
parent 00ed1e0be1
commit 8e9c3483aa
18 changed files with 874 additions and 0 deletions

31
Node.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef NODE_H
#define NODE_H
#include <torch/torch.h>
#include <vector>
#include <string>
namespace bayesnet {
using namespace std;
class Node {
private:
static int next_id;
const int id;
string name;
vector<Node*> parents;
vector<Node*> children;
int numStates;
torch::Tensor cpt;
public:
Node(const std::string& name, int numStates);
void addParent(Node* parent);
void addChild(Node* child);
string getName() const;
vector<Node*>& getParents();
vector<Node*>& getChildren();
torch::Tensor& getCPT();
void setCPT(const torch::Tensor& cpt);
int getNumStates() const;
int getId() const { return id; }
string getCPDKey(const Node*) const;
};
}
#endif