BayesNet 1.0.5
Bayesian Network Classifiers using libtorch from scratch
Loading...
Searching...
No Matches
bayesnet::Network Class Reference

Public Member Functions

 Network (float)
 
 Network (const Network &)
 
torch::Tensor & getSamples ()
 
float getMaxThreads () const
 
void addNode (const std::string &)
 
void addEdge (const std::string &, const std::string &)
 
std::map< std::string, std::unique_ptr< Node > > & getNodes ()
 
std::vector< std::string > getFeatures () const
 
int getStates () const
 
std::vector< std::pair< std::string, std::string > > getEdges () const
 
int getNumEdges () const
 
int getClassNumStates () const
 
std::string getClassName () const
 
void fit (const std::vector< std::vector< int > > &input_data, const std::vector< int > &labels, const std::vector< double > &weights, const std::vector< std::string > &featureNames, const std::string &className, const std::map< std::string, std::vector< int > > &states)
 
void fit (const torch::Tensor &X, const torch::Tensor &y, const torch::Tensor &weights, const std::vector< std::string > &featureNames, const std::string &className, const std::map< std::string, std::vector< int > > &states)
 
void fit (const torch::Tensor &samples, const torch::Tensor &weights, const std::vector< std::string > &featureNames, const std::string &className, const std::map< std::string, std::vector< int > > &states)
 
std::vector< int > predict (const std::vector< std::vector< int > > &)
 
torch::Tensor predict (const torch::Tensor &)
 
torch::Tensor predict_tensor (const torch::Tensor &samples, const bool proba)
 
std::vector< std::vector< double > > predict_proba (const std::vector< std::vector< int > > &)
 
torch::Tensor predict_proba (const torch::Tensor &)
 
double score (const std::vector< std::vector< int > > &, const std::vector< int > &)
 
std::vector< std::string > topological_sort ()
 
std::vector< std::string > show () const
 
std::vector< std::string > graph (const std::string &title) const
 
void initialize ()
 
std::string dump_cpt () const
 
std::string version ()
 

Detailed Description

Definition at line 15 of file Network.h.

Constructor & Destructor Documentation

◆ Network() [1/3]

bayesnet::Network::Network ( )

Definition at line 13 of file Network.cc.

◆ Network() [2/3]

bayesnet::Network::Network ( float maxT)
explicit

Definition at line 16 of file Network.cc.

◆ Network() [3/3]

bayesnet::Network::Network ( const Network & other)
explicit

Definition at line 20 of file Network.cc.

Member Function Documentation

◆ addEdge()

void bayesnet::Network::addEdge ( const std::string & parent,
const std::string & child )

Definition at line 95 of file Network.cc.

◆ addNode()

void bayesnet::Network::addNode ( const std::string & name)

Definition at line 46 of file Network.cc.

◆ dump_cpt()

std::string bayesnet::Network::dump_cpt ( ) const

Definition at line 420 of file Network.cc.

◆ fit() [1/3]

void bayesnet::Network::fit ( const std::vector< std::vector< int > > & input_data,
const std::vector< int > & labels,
const std::vector< double > & weights,
const std::vector< std::string > & featureNames,
const std::string & className,
const std::map< std::string, std::vector< int > > & states )

Definition at line 177 of file Network.cc.

◆ fit() [2/3]

void bayesnet::Network::fit ( const torch::Tensor & samples,
const torch::Tensor & weights,
const std::vector< std::string > & featureNames,
const std::string & className,
const std::map< std::string, std::vector< int > > & states )

Definition at line 169 of file Network.cc.

◆ fit() [3/3]

void bayesnet::Network::fit ( const torch::Tensor & X,
const torch::Tensor & y,
const torch::Tensor & weights,
const std::vector< std::string > & featureNames,
const std::string & className,
const std::map< std::string, std::vector< int > > & states )

Definition at line 158 of file Network.cc.

◆ getClassName()

std::string bayesnet::Network::getClassName ( ) const

Definition at line 75 of file Network.cc.

◆ getClassNumStates()

int bayesnet::Network::getClassNumStates ( ) const

Definition at line 63 of file Network.cc.

◆ getEdges()

std::vector< std::pair< std::string, std::string > > bayesnet::Network::getEdges ( ) const

Definition at line 371 of file Network.cc.

◆ getFeatures()

std::vector< std::string > bayesnet::Network::getFeatures ( ) const

Definition at line 59 of file Network.cc.

◆ getMaxThreads()

float bayesnet::Network::getMaxThreads ( ) const

Definition at line 38 of file Network.cc.

◆ getNodes()

std::map< std::string, std::unique_ptr< Node > > & bayesnet::Network::getNodes ( )

Definition at line 116 of file Network.cc.

◆ getNumEdges()

int bayesnet::Network::getNumEdges ( ) const

Definition at line 383 of file Network.cc.

◆ getSamples()

torch::Tensor & bayesnet::Network::getSamples ( )

Definition at line 42 of file Network.cc.

◆ getStates()

int bayesnet::Network::getStates ( ) const

Definition at line 67 of file Network.cc.

◆ graph()

std::vector< std::string > bayesnet::Network::graph ( const std::string & title) const

Definition at line 357 of file Network.cc.

◆ initialize()

void bayesnet::Network::initialize ( )

Definition at line 29 of file Network.cc.

◆ predict() [1/2]

std::vector< int > bayesnet::Network::predict ( const std::vector< std::vector< int > > & tsamples)

Definition at line 237 of file Network.cc.

◆ predict() [2/2]

torch::Tensor bayesnet::Network::predict ( const torch::Tensor & samples)

Definition at line 230 of file Network.cc.

◆ predict_proba() [1/2]

std::vector< std::vector< double > > bayesnet::Network::predict_proba ( const std::vector< std::vector< int > > & tsamples)

Definition at line 259 of file Network.cc.

◆ predict_proba() [2/2]

torch::Tensor bayesnet::Network::predict_proba ( const torch::Tensor & samples)

Definition at line 224 of file Network.cc.

◆ predict_tensor()

torch::Tensor bayesnet::Network::predict_tensor ( const torch::Tensor & samples,
const bool proba )

Definition at line 205 of file Network.cc.

◆ score()

double bayesnet::Network::score ( const std::vector< std::vector< int > > & tsamples,
const std::vector< int > & labels )

Definition at line 275 of file Network.cc.

◆ show()

std::vector< std::string > bayesnet::Network::show ( ) const

Definition at line 344 of file Network.cc.

◆ topological_sort()

std::vector< std::string > bayesnet::Network::topological_sort ( )

Definition at line 387 of file Network.cc.

◆ version()

std::string bayesnet::Network::version ( )
inline

Definition at line 49 of file Network.h.


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