root/libBM.h @ 5

Revision 5, 2.1 kB (checked in by smidl, 17 years ago)

RV

  • Property svn:eol-style set to native
RevLine 
[2]1/*!
[5]2  \file
3  \brief Bayesian Models (bm) that use Bayes rule to learn from observations
4  \author Vaclav Smidl.
[2]5
[5]6  -----------------------------------
7  BDM++ - C++ library for Bayesian Decision Making under Uncertainty
8
9  Using IT++ for numerical operations
10  -----------------------------------
11*/
12
[2]13#ifndef BM_H
14#define BM_H
15
16#include <itpp/itbase.h>
17//#include <std>
18
19using namespace itpp;
20
[5]21/*!
22* \brief Class representing variables, most often random variables
23
24* More?...
25*/
[2]26class RV {
[5]27        int len;
28        ivec ids;
29        ivec sizes;
30        ivec times;
31        ivec obs;
32        Array<std::string> names;
[2]33
[5]34private:
35        void init ( ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times, ivec in_obs );
[2]36public:
[5]37        //! Full constructor which is called by the others
38        RV ( ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times, ivec in_obs );
39        //! default constructor
40        RV ( ivec ids );
41        //! Printing output e.g. for debugging.
42        friend std::ostream &operator<< ( std::ostream &os, const RV &rv );
43
44        //! Find indexes of another rv in self
45        ivec rvfind(RV rv2);
46        //! Add (concat) another variable to the current one
47        RV rvadd(RV rv2);
48        //! Subtract  another variable from the current one
49        RV rvsubt(RV rv2);
50        //! Select only variables at indeces ind
51        RV rvsubselect(ivec ind);
52        //! Select only variables at indeces ind
53        RV operator()(ivec ind);
[2]54};
55
56
57
58
59//! Class representing function of variables
60class fnc {
[5]61        RV rv;
[2]62};
63
[4]64//! Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.
[2]65class BM {
66public:
[5]67        //! Incremental Bayes rule
68        void bayes ( vec dt );
69        //! Batch Bayes rule (columns of Dt are observations)
70        virtual void bayes ( mat Dt );
[2]71};
72
[4]73//! Probability density function with numerical statistics, e.g. posterior density.
[2]74class epdf {
[5]75        RV rv;
[2]76public:
[5]77        //! Returns the required moment of the epdf
78        virtual vec moment ( const int order = 1 );
[2]79};
80
[5]81//! Conditional probability density, e.g. modeling some dependencies.
[2]82class mpdf {
[5]83        //! modeled random variable
84        RV rv;
85        //! random variable in condition
86        RV rvc;
[2]87public:
88
[5]89        //! Returns the required moment of the epdf
90        virtual fnc moment ( const int order = 1 );
[2]91};
92
93#endif // BM_H
Note: See TracBrowser for help on using the browser.