aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
KTBNLearner.h File Reference

A structure/parameter learner for k-order dynamic Bayesian networks. More...

#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <agrum/agrum.h>
#include <agrum/BN/learning/BNLearner.h>
#include <agrum/KTBN/learning/IKTBNLearner.h>
#include <string_view>
#include <unordered_set>
#include <agrum/KTBN/learning/KTBNLearner_tpl.h>
Include dependency graph for KTBNLearner.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gum::learning::KTBNLearner< GUM_SCALAR >
 Learns a k-TBN (structure and/or parameters) from trajectory CSVs. More...

Namespaces

namespace  gum
 gum is the global namespace for all aGrUM entities
namespace  gum::learning
 include the inlined functions if necessary

Variables

template class GUM_PUBLIC_KTBN gum::learning::KTBNLearner< double >

Detailed Description

A structure/parameter learner for k-order dynamic Bayesian networks.

gum::learning::KTBNLearner is the k-TBN counterpart of gum::learning::BNLearner. It learns a gum::KTBN from a set of trajectory CSV files (one file per trajectory, as produced by gum::learning::KTBNDatabaseGenerator: one column per base variable, one row per time step).

It is not a subclass of BNLearner. Instead it wraps three BNLearner instances and reduces k-TBN learning to three ordinary BN-learning problems on three flat tables built from the trajectories:

  • the transition table (sliding windows of width \(k\)): learns the repeating kernel, i.e. the arcs arriving at slice \(k-1\);
  • the initial table (the first \(k-1\) time steps of each trajectory): learns the distribution of the initial slices;
  • the atemporal table (the atemporal columns, one row per trajectory): learns the arcs between atemporal variables (built only when there are at least two atemporal variables). The three learned BayesNets are then glued back into a single gum::KTBN. The temporal ordering and no-backward-arc constraints are applied automatically and invisibly.
// atemporal variables inferred from the data (see the tagless constructor)
gum::learning::KTBNLearner< double > learner("trajs/", "traj", 500, 2);
learner.useScoreBIC().useGreedyHillClimbing();
gum::KTBN< double > kdbn = learner.learnKTBN();
// or state the classification explicitly
const std::unordered_set< std::string > atemporal{"C", "D"};
gum::learning::KTBNLearner< double > learner2("trajs/", "traj", 500, 2, atemporal);
template class GUM_PUBLIC_KTBN KTBNLearner< double >
template class GUM_PUBLIC_KTBN KTBN< double >
Definition KTBN.cpp:53
Author
Seth AGUILA & Anis KHACEF

Definition in file KTBNLearner.h.