|
| template<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. More...
|
| |
| template<pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Operator::Restrict OR = pRC::Operator::Restrict::None, pRC::Operator::Hint OH = pRC::Operator::Hint::None, class T1 , pRC::Size D, class T2 , pRC::Size... Ns, pRC::If< pRC::IsSatisfied<(OR==pRC::Operator::Restrict::None)> > = 0, pRC::If< pRC::IsSatisfied<(OT==pRC::Operator::Transform::None)> > = 0> |
| static constexpr auto | applyDerivative (MHNOperator< T1, D > const &op, pRC::Tensor< T2, Ns... > const &x, pRC::Index const &i) |
| | apply the derivative of an MHN Q wrt to theta_ii to a vector x More...
|
| |
| template<pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Operator::Restrict OR = pRC::Operator::Restrict::None, pRC::Operator::Hint OH = pRC::Operator::Hint::None, class T1 , pRC::Size D, class T2 , pRC::Size... Ns, pRC::If< pRC::IsSatisfied<(OR==pRC::Operator::Restrict::None)> > = 0> |
| static constexpr auto | apply (MHNOperator< T1, D > const &op, pRC::Tensor< T2, Ns... > const &x) |
| | apply (1-Q) or its transposed to a vector x, given an MHN Q More...
|
| |
template<pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Operator::Restrict OR = pRC::Operator::Restrict::None, pRC::Operator::Hint OH = pRC::Operator::Hint::None, class T1 , pRC::Size D, class T2 , pRC::Size... Ns, pRC::If< pRC::IsSatisfied<(OR==pRC::Operator::Restrict::None)> > = 0>
| static constexpr auto cMHN::nonTT::apply |
( |
MHNOperator< T1, D > const & |
op, |
|
|
pRC::Tensor< T2, Ns... > const & |
x |
|
) |
| |
|
inlinestaticconstexpr |
apply (1-Q) or its transposed to a vector x, given an MHN Q
- Template Parameters
-
| T1 | type used for calculations (from MHN Operator, inferred) |
| T2 | type used for calculations (from vector x, inferred) |
| D | number of events of the dataset (inferred) |
| Ns... | Mode sizes of the D events (usually D instances of 2, inferred) |
- Parameters
-
| op | MHN Operator to apply |
| x | vector to apply (1-Q) (or its transposed) to |
template<pRC::Operator::Transform OT = pRC::Operator::Transform::None, pRC::Operator::Restrict OR = pRC::Operator::Restrict::None, pRC::Operator::Hint OH = pRC::Operator::Hint::None, class T1 , pRC::Size D, class T2 , pRC::Size... Ns, pRC::If< pRC::IsSatisfied<(OR==pRC::Operator::Restrict::None)> > = 0, pRC::If< pRC::IsSatisfied<(OT==pRC::Operator::Transform::None)> > = 0>
| static constexpr auto cMHN::nonTT::applyDerivative |
( |
MHNOperator< T1, D > const & |
op, |
|
|
pRC::Tensor< T2, Ns... > const & |
x, |
|
|
pRC::Index const & |
i |
|
) |
| |
|
inlinestaticconstexpr |
apply the derivative of an MHN Q wrt to theta_ii to a vector x
- Template Parameters
-
| T1 | type used for calculations (from MHN Operator, inferred) |
| T2 | type used for calculations (from vector x, inferred) |
| D | number of events of the dataset (inferred) |
| Ns... | Mode sizes of the D events (usually D instances of 2) |
- Parameters
-
| op | MHN Operator to calculate derivative of |
| x | vector to apply derivative to |
| i | index of theta entry wrt which derivative is taken of |
template<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::nonTT::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.
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
-
| T | type used for calculations (inferred) |
| D | number of events of the dataset (inferred) |
| S | Subscripts type used as keys in data distribution (inferred) |
- Parameters
-
| theta | theta matrix representing the initial MHN |
| header | header of the data (usually containing event names) |
| output | file to write the theta matrix to |
| pD | data distribution to learn |
| Score | Score object representing the score used |
| Regulator | Regulator object representing the regulator used |
| toleranceOptimizer | tolerance of the optimizer |
| toleranceSovlerP | tolerance of the solver for calculating pTheta |
| toleranceSolverQ | tolerance of the solver for calculating q (intermediate result for calculating the derivatives) |