root/library/tests/pdf_harness.h
@
722
| Revision 722, 1.0 kB (checked in by mido, 16 years ago) | |
|---|---|
|
|
| Rev | Line | |
|---|---|---|
| [447] | 1 | /*! |
| 2 | \file | |
| [693] | 3 | \brief Support for testing descendants of pdf. |
| [447] | 4 | \author Vaclav Barta. |
| 5 | ||
| 6 | ----------------------------------- | |
| 7 | BDM++ - C++ library for Bayesian Decision Making under Uncertainty | |
| 8 | ||
| 9 | Using IT++ for numerical operations | |
| 10 | ----------------------------------- | |
| 11 | */ | |
| 12 | ||
| [693] | 13 | #ifndef pdf_HARNESS_H |
| 14 | #define pdf_HARNESS_H | |
| [447] | 15 | |
| 16 | #include "bdmroot.h" | |
| 17 | #include "itpp_ext.h" | |
| 18 | #include "shared_ptr.h" | |
| 19 | #include "base/bdmbase.h" | |
| 20 | #include "base/user_info.h" | |
| 21 | ||
| [477] | 22 | namespace bdm { |
| [447] | 23 | |
| [693] | 24 | class pdf_harness : public root { |
| [447] | 25 | private: |
| [693] | 26 | shared_ptr<pdf> hpdf; |
| [477] | 27 | vec cond; |
| 28 | vec mean; | |
| [484] | 29 | vec variance; |
| [477] | 30 | int nsamples; |
| 31 | mat R; | |
| 32 | double tolerance; | |
| [447] | 33 | |
| [477] | 34 | public: |
| 35 | static void test_config ( const char *config_file_name ); | |
| [447] | 36 | |
| [693] | 37 | pdf_harness() : nsamples ( 1000 ), tolerance ( 0.1 ) { } |
| [447] | 38 | |
| [477] | 39 | virtual void test ( const char *config_name, int idx ); |
| [456] | 40 | |
| [477] | 41 | void from_setting ( const Setting &set ); |
| [447] | 42 | |
| 43 | protected: | |
| [693] | 44 | pdf *get_pdf() { |
| 45 | return hpdf.get(); | |
| [477] | 46 | } |
| [484] | 47 | |
| 48 | private: | |
| 49 | void check_mean(); | |
| 50 | ||
| 51 | // assumes R is valid | |
| 52 | void check_covariance(); | |
| [447] | 53 | }; |
| [722] | 54 | UIREGISTER ( pdf_harness ); |
| [447] | 55 | |
| 56 | } | |
| 57 | ||
| 58 | #endif |
Note: See TracBrowser
for help on using the browser.
