cMHN 1.0
C++ library for learning MHNs with pRC
Classes | Functions
cMHN::TT Namespace Reference

Classes

class  MHNOperator
 Class storing an MHN operator represented by a theta matrix (for TT calculations) More...
 

Functions

template<pRC::Size R, pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Size D, class T , class Tb , class X >
auto ALS (MHNOperator< T, D > const &MHNop, Tb const &b, T const &tolerance, X const &x0)
 
template<pRC::Size R, pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Size D, class T , class Tb >
auto ALS (MHNOperator< T, D > const &MHNop, Tb const &b, T const &tolerance)
 
template<pRC::Size RP, pRC::Size RQ, class T , pRC::Size D, class S >
std::tuple< pRC::Tensor< T, D, D >, std::map< std::string, std::string >, std::map< std::string, double > > learnTheta (pRC::Tensor< T, D, D > const &theta, std::string const &header, std::string const &output, std::map< S, T > const &pD, cMHN::Score< T > const &Score, cMHN::Regulator< T, D > const &Regulator, T const &toleranceOptimizer, T const &toleranceSolverP, T const &toleranceSolverQ)
 Optimizes an MHN represented by a theta matrix to best describe a given data distribution using the TT format. More...
 
template<pRC::Size R, pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Size D, class T , class Tb >
auto MAMEN (MHNOperator< T, D > const &MHNop, Tb const &b, T const &tolerance)
 
template<pRC::Size D, pRC::Size N = 2>
constexpr auto getModeSizes ()
 
template<pRC::Size D, pRC::Size R, pRC::Size N = 2>
constexpr auto getRanks ()
 

Function Documentation

◆ ALS() [1/2]

template<pRC::Size R, pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Size D, class T , class Tb >
auto cMHN::TT::ALS ( MHNOperator< T, D > const &  MHNop,
Tb const &  b,
T const &  tolerance 
)

◆ ALS() [2/2]

template<pRC::Size R, pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Size D, class T , class Tb , class X >
auto cMHN::TT::ALS ( MHNOperator< T, D > const &  MHNop,
Tb const &  b,
T const &  tolerance,
X const &  x0 
)

◆ getModeSizes()

template<pRC::Size D, pRC::Size N = 2>
constexpr auto cMHN::TT::getModeSizes ( )
constexpr

◆ getRanks()

template<pRC::Size D, pRC::Size R, pRC::Size N = 2>
constexpr auto cMHN::TT::getRanks ( )
constexpr

◆ learnTheta()

template<pRC::Size RP, pRC::Size RQ, class T , pRC::Size D, class S >
std::tuple< pRC::Tensor< T, D, D >, std::map< std::string, std::string >, std::map< std::string, double > > cMHN::TT::learnTheta ( pRC::Tensor< T, D, D > const &  theta,
std::string const &  header,
std::string const &  output,
std::map< S, T > const &  pD,
cMHN::Score< T > const &  Score,
cMHN::Regulator< T, D > const &  Regulator,
T const &  toleranceOptimizer,
T const &  toleranceSolverP,
T const &  toleranceSolverQ 
)

Optimizes an MHN represented by a theta matrix to best describe a given data distribution using the TT format.

The optimization is done by BFGS. Logging information containing Score and Regulator names, Iteration number, Time, Score and Regularization strength is written to file after every iteration.

The optimized theta is returned. Additionally, two std::maps are returned containing logging information:

  • std::map<std::string, std::string> logInfoNames: Info like Score name and Regulator name
  • std::map<std::string, double> logInfoNumbers: Info like final score and runtime
Template Parameters
RPmax TT rank used for pTheta
RQmax TT rank used for q in calculation of derivatives
Ttype used for calculations (inferred)
Dnumber of events of the dataset (inferred)
SSubscripts type used as keys in data distribution (inferred)
Parameters
thetatheta matrix representing the initial MHN
headerheader of the data (usually containing event names)
outputfile to write the theta matrix to
pDdata distribution to learn
ScoreScore object representing the score used
RegulatorRegulator object representing the regulator used
toleranceOptimizertolerance of the optimizer
toleranceSovlerPtolerance of the solver for calculating pTheta
toleranceSolverQtolerance of the solver for calculating q (intermediate result for calculating the derivatives)

◆ MAMEN()

template<pRC::Size R, pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Size D, class T , class Tb >
auto cMHN::TT::MAMEN ( MHNOperator< T, D > const &  MHNop,
Tb const &  b,
T const &  tolerance 
)