Add getStates method

This commit is contained in:
Ricardo Montañana Gómez 2023-07-09 16:25:24 +02:00
parent c4836bd5e3
commit 3750662f2c
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
2 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,14 @@ namespace bayesnet {
{ {
return classNumStates; return classNumStates;
} }
int Network::getStates()
{
int result = 0;
for (auto node : nodes) {
result += node.second->getNumStates();
}
return result;
}
string Network::getClassName() string Network::getClassName()
{ {
return className; return className;

View File

@ -30,6 +30,7 @@ namespace bayesnet {
void addEdge(const string, const string); void addEdge(const string, const string);
map<string, Node*>& getNodes(); map<string, Node*>& getNodes();
vector<string> getFeatures(); vector<string> getFeatures();
int getStates();
int getClassNumStates(); int getClassNumStates();
string getClassName(); string getClassName();
void fit(const vector<vector<int>>&, const vector<int>&, const vector<string>&, const string&); void fit(const vector<vector<int>>&, const vector<int>&, const vector<string>&, const string&);