Revision 2, 1.3 kB
(checked in by smidl, 17 years ago)
|
first shot
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[2] | 1 | /*! |
---|
| 2 | * \file |
---|
| 3 | * \brief Bayesian Models (bm) that use Bayes rule to learn from observations |
---|
| 4 | * \author Vaclav Smidl. |
---|
| 5 | * |
---|
| 6 | * ----------------------------------- |
---|
| 7 | * BDM++ - C++ library for Bayesian Decision Making under Uncertainty |
---|
| 8 | * |
---|
| 9 | * Using IT++ for numerical operations |
---|
| 10 | * ----------------------------------- |
---|
| 11 | */ |
---|
| 12 | |
---|
| 13 | #ifndef BM_H |
---|
| 14 | #define BM_H |
---|
| 15 | |
---|
| 16 | #include <itpp/itbase.h> |
---|
| 17 | //#include <std> |
---|
| 18 | |
---|
| 19 | using namespace itpp; |
---|
| 20 | |
---|
| 21 | class RV { |
---|
| 22 | int len; |
---|
| 23 | ivec ids; |
---|
| 24 | ivec sizes; |
---|
| 25 | ivec times; |
---|
| 26 | ivec obs; |
---|
| 27 | Array<std::string> names; |
---|
| 28 | |
---|
| 29 | public: |
---|
| 30 | //! Full constructor which is called by the others |
---|
| 31 | RV(ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times, ivec in_obs); |
---|
| 32 | //! default constructor |
---|
| 33 | RV(ivec ids); |
---|
| 34 | friend std::ostream &operator<<(std::ostream &os, const RV &rv); |
---|
| 35 | }; |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | //! Class representing function of variables |
---|
| 41 | class fnc { |
---|
| 42 | RV rv; |
---|
| 43 | }; |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | class BM { |
---|
| 47 | public: |
---|
| 48 | //! Incremental Bayes rule |
---|
| 49 | void bayes(vec dt); |
---|
| 50 | //! Batch Bayes rule (columns of Dt are observations) |
---|
| 51 | virtual void bayes(mat Dt); |
---|
| 52 | }; |
---|
| 53 | |
---|
| 54 | class epdf { |
---|
| 55 | RV rv; |
---|
| 56 | public: |
---|
| 57 | //! Returns the required moment of the epdf |
---|
| 58 | virtual vec moment(const int order = 1); |
---|
| 59 | }; |
---|
| 60 | |
---|
| 61 | class mpdf { |
---|
| 62 | //! modeled random variable |
---|
| 63 | RV rv; |
---|
| 64 | //! random variable in condition |
---|
| 65 | RV rvc; |
---|
| 66 | public: |
---|
| 67 | |
---|
| 68 | //! Returns the required moment of the epdf |
---|
| 69 | virtual fnc moment(const int order = 1); |
---|
| 70 | }; |
---|
| 71 | |
---|
| 72 | #endif // BM_H |
---|