update Discrete group

release/4.3a0
Varun Agrawal 2022-07-26 16:55:28 -04:00
parent 95b86356ac
commit 92e1014874
17 changed files with 40 additions and 5 deletions

View File

@ -31,6 +31,8 @@ namespace gtsam {
* Algebraic Decision Trees fix the range to double * Algebraic Decision Trees fix the range to double
* Just has some nice constructors and some syntactic sugar * Just has some nice constructors and some syntactic sugar
* TODO: consider eliminating this class altogether? * TODO: consider eliminating this class altogether?
*
* @ingroup discrete
*/ */
template <typename L> template <typename L>
class GTSAM_EXPORT AlgebraicDecisionTree : public DecisionTree<L, double> { class GTSAM_EXPORT AlgebraicDecisionTree : public DecisionTree<L, double> {

View File

@ -29,6 +29,7 @@ namespace gtsam {
* An assignment from labels to value index (size_t). * An assignment from labels to value index (size_t).
* Assigns to each label a value. Implemented as a simple map. * Assigns to each label a value. Implemented as a simple map.
* A discrete factor takes an Assignment and returns a value. * A discrete factor takes an Assignment and returns a value.
* @ingroup discrete
*/ */
template <class L> template <class L>
class Assignment : public std::map<L, size_t> { class Assignment : public std::map<L, size_t> {

View File

@ -38,6 +38,8 @@ namespace gtsam {
* Decision Tree * Decision Tree
* L = label for variables * L = label for variables
* Y = function range (any algebra), e.g., bool, int, double * Y = function range (any algebra), e.g., bool, int, double
*
* @ingroup discrete
*/ */
template<typename L, typename Y> template<typename L, typename Y>
class DecisionTree { class DecisionTree {

View File

@ -36,7 +36,9 @@ namespace gtsam {
class DiscreteConditional; class DiscreteConditional;
/** /**
* A discrete probabilistic factor * A discrete probabilistic factor.
*
* @ingroup discrete
*/ */
class GTSAM_EXPORT DecisionTreeFactor : public DiscreteFactor, class GTSAM_EXPORT DecisionTreeFactor : public DiscreteFactor,
public AlgebraicDecisionTree<Key> { public AlgebraicDecisionTree<Key> {

View File

@ -33,7 +33,7 @@ namespace gtsam {
/** /**
* A Bayes net made from discrete conditional distributions. * A Bayes net made from discrete conditional distributions.
* @addtogroup discrete * @ingroup discrete
*/ */
class GTSAM_EXPORT DiscreteBayesNet: public BayesNet<DiscreteConditional> { class GTSAM_EXPORT DiscreteBayesNet: public BayesNet<DiscreteConditional> {
public: public:

View File

@ -62,7 +62,10 @@ class GTSAM_EXPORT DiscreteBayesTreeClique
}; };
/* ************************************************************************* */ /* ************************************************************************* */
/** A Bayes tree representing a Discrete density */ /**
* @brief A Bayes tree representing a Discrete density.
* @ingroup discrete
*/
class GTSAM_EXPORT DiscreteBayesTree class GTSAM_EXPORT DiscreteBayesTree
: public BayesTree<DiscreteBayesTreeClique> { : public BayesTree<DiscreteBayesTreeClique> {
private: private:

View File

@ -32,6 +32,8 @@ namespace gtsam {
/** /**
* Discrete Conditional Density * Discrete Conditional Density
* Derives from DecisionTreeFactor * Derives from DecisionTreeFactor
*
* @ingroup discrete
*/ */
class GTSAM_EXPORT DiscreteConditional class GTSAM_EXPORT DiscreteConditional
: public DecisionTreeFactor, : public DecisionTreeFactor,

View File

@ -27,6 +27,8 @@ namespace gtsam {
/** /**
* A prior probability on a set of discrete variables. * A prior probability on a set of discrete variables.
* Derives from DiscreteConditional * Derives from DiscreteConditional
*
* @ingroup discrete
*/ */
class GTSAM_EXPORT DiscreteDistribution : public DiscreteConditional { class GTSAM_EXPORT DiscreteDistribution : public DiscreteConditional {
public: public:

View File

@ -24,6 +24,10 @@
namespace gtsam { namespace gtsam {
/**
* @brief Elimination tree for discrete factors.
* @ingroup discrete
*/
class GTSAM_EXPORT DiscreteEliminationTree : class GTSAM_EXPORT DiscreteEliminationTree :
public EliminationTree<DiscreteBayesNet, DiscreteFactorGraph> public EliminationTree<DiscreteBayesNet, DiscreteFactorGraph>
{ {

View File

@ -31,6 +31,8 @@ class DiscreteConditional;
/** /**
* Base class for discrete probabilistic factors * Base class for discrete probabilistic factors
* The most general one is the derived DecisionTreeFactor * The most general one is the derived DecisionTreeFactor
*
* @ingroup discrete
*/ */
class GTSAM_EXPORT DiscreteFactor: public Factor { class GTSAM_EXPORT DiscreteFactor: public Factor {

View File

@ -40,7 +40,14 @@ class DiscreteEliminationTree;
class DiscreteBayesTree; class DiscreteBayesTree;
class DiscreteJunctionTree; class DiscreteJunctionTree;
/** Main elimination function for DiscreteFactorGraph */ /**
* @brief Main elimination function for DiscreteFactorGraph.
*
* @param factors
* @param keys
* @return GTSAM_EXPORT
* @ingroup discrete
*/
GTSAM_EXPORT std::pair<boost::shared_ptr<DiscreteConditional>, DecisionTreeFactor::shared_ptr> GTSAM_EXPORT std::pair<boost::shared_ptr<DiscreteConditional>, DecisionTreeFactor::shared_ptr>
EliminateDiscrete(const DiscreteFactorGraph& factors, const Ordering& keys); EliminateDiscrete(const DiscreteFactorGraph& factors, const Ordering& keys);
@ -64,6 +71,7 @@ template<> struct EliminationTraits<DiscreteFactorGraph>
/** /**
* A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e. * A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e.
* Factor == DiscreteFactor * Factor == DiscreteFactor
* @ingroup discrete
*/ */
class GTSAM_EXPORT DiscreteFactorGraph class GTSAM_EXPORT DiscreteFactorGraph
: public FactorGraph<DiscreteFactor>, : public FactorGraph<DiscreteFactor>,

View File

@ -44,7 +44,8 @@ namespace gtsam {
* The tree structure and elimination method are exactly analogous to the EliminationTree, * The tree structure and elimination method are exactly analogous to the EliminationTree,
* except that in the JunctionTree, at each node multiple variables are eliminated at a time. * except that in the JunctionTree, at each node multiple variables are eliminated at a time.
* *
* \addtogroup Multifrontal * \ingroup Multifrontal
* @ingroup discrete
* \nosubgrouping * \nosubgrouping
*/ */
class GTSAM_EXPORT DiscreteJunctionTree : class GTSAM_EXPORT DiscreteJunctionTree :

View File

@ -30,6 +30,7 @@ namespace gtsam {
/** /**
* Key type for discrete variables. * Key type for discrete variables.
* Includes Key and cardinality. * Includes Key and cardinality.
* @ingroup discrete
*/ */
using DiscreteKey = std::pair<Key,size_t>; using DiscreteKey = std::pair<Key,size_t>;

View File

@ -32,6 +32,7 @@ class DiscreteBayesNet;
/** /**
* @brief DiscreteLookupTable table for max-product * @brief DiscreteLookupTable table for max-product
* @ingroup discrete
* *
* Inherits from discrete conditional for convenience, but is not normalized. * Inherits from discrete conditional for convenience, but is not normalized.
* Is used in the max-product algorithm. * Is used in the max-product algorithm.

View File

@ -28,6 +28,7 @@ namespace gtsam {
/** /**
* A class for computing marginals of variables in a DiscreteFactorGraph * A class for computing marginals of variables in a DiscreteFactorGraph
* @ingroup discrete
*/ */
class DiscreteMarginals { class DiscreteMarginals {

View File

@ -36,6 +36,7 @@ namespace gtsam {
* Another good thing is we don't need to have the special DiscreteKey which * Another good thing is we don't need to have the special DiscreteKey which
* stores cardinality of a Discrete variable. It should be handled naturally in * stores cardinality of a Discrete variable. It should be handled naturally in
* the new class DiscreteValue, as the variable's type (domain) * the new class DiscreteValue, as the variable's type (domain)
* @ingroup discrete
*/ */
class GTSAM_EXPORT DiscreteValues : public Assignment<Key> { class GTSAM_EXPORT DiscreteValues : public Assignment<Key> {
public: public:

View File

@ -48,6 +48,8 @@ namespace gtsam {
* (E|T,L) = "F F F 1" * (E|T,L) = "F F F 1"
* X|E = "95/5 2/98" * X|E = "95/5 2/98"
* (D|E,B) = "9/1 2/8 3/7 1/9" * (D|E,B) = "9/1 2/8 3/7 1/9"
*
* @ingroup discrete
*/ */
class GTSAM_EXPORT Signature { class GTSAM_EXPORT Signature {