Changeset 661 for library/doc/tutorial
- Timestamp:
- 10/15/09 00:10:19 (15 years ago)
- Location:
- library/doc/tutorial
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
library/doc/tutorial/01userguide.dox
r659 r661 2 2 \page userguide BDM Use - System, Data, Simulation 3 3 4 This section serves as introdustion to the scenario of data simulation. Since it is the simpliest of all scenarios defined in \ref 005userguide0 it also serves as introduction to configuration of an experiment (see \ref ui) and basic decision making objects (bdm::RV and bdm::DS).4 This section serves as introdustion to the scenario of data simulation. Since it is the simpliest of all scenarios defined in \ref user_guide0 it also serves as introduction to configuration of an experiment (see \ref ui_page) and basic decision making objects (bdm::RV and bdm::DS). 5 5 6 6 All experiments are demonstarted on scenario simulator which can be either standalone application or mex file (simulator.mex**). … … 75 75 \section ug_memds DataSource of pre-recorded data -- MemDS 76 76 77 The first experiment run in \ref first was actually an instance of DataSource of pre-recorded data that were stored in memory, i.e. the bdm::MemDS class.77 The first experiment run in \ref ug_first was actually an instance of DataSource of pre-recorded data that were stored in memory, i.e. the bdm::MemDS class. 78 78 79 79 Operation of such object is trivial, the data are stored as a matrix and the general operations defined above are specialized as follows: … … 140 140 141 141 142 \section loggers Loggers for flexible handling of results142 \section ug_loggers Loggers for flexible handling of results 143 143 Loggers are universal objects for storing and manipulating the results of an experiment. Similar to DataSource, every logger has to provide basic functionality: 144 144 -# initialize its storage (bdm::logger.init()), … … 165 165 - bdm::stateDS 166 166 167 The MemDS has already been introduced in the example in \ref memds.167 The MemDS has already been introduced in the example in \ref ug_memds. 168 168 However, any of the classes listed above can be used to replace it in the example. 169 169 This will be demonstrated on the \c EpdfDS class. … … 230 230 u = RV({'u'}); 231 231 232 fy.class = 'mlnorm <ldmat>';232 fy.class = 'mlnorm\<ldmat\>'; 233 233 fy.rv = y; 234 234 fy.rvc = RV({'y','u'}, [1 1], [-3, -1]); … … 238 238 239 239 240 fu.class = 'enorm <ldmat>';240 fu.class = 'enorm\<ldmat\>'; 241 241 fu.rv = u; 242 242 fu.mu = 0; … … 249 249 250 250 Explanation of this example will require few remarks: 251 - class of the \c fy object is 'mlnorm <ldmat>' which is Normal pdf with mean value given by linear function, and covariance matrix stored in LD decomposition, see bdm::mlnorm for details.252 - naming convention 'mlnorm <ldmat>' relates to the concept of templates in C++. For those unfamiliar with this concept, it is basicaly a way how to share code for different flavours of the same object. Note that mlnorm exist in three versions: mlnorm<ldmat>, mlnorm<chmat>, mlnorm<fsqmat>. Those classes act identically the only difference is that the internal data are stored either in LD decomposition, choleski decomposition or full matrices, respectively.251 - class of the \c fy object is 'mlnorm\<ldmat\>' which is Normal pdf with mean value given by linear function, and covariance matrix stored in LD decomposition, see bdm::mlnorm for details. 252 - naming convention 'mlnorm\<ldmat\>' relates to the concept of templates in C++. For those unfamiliar with this concept, it is basicaly a way how to share code for different flavours of the same object. Note that mlnorm exist in three versions: mlnorm\<ldmat\>, mlnorm<chmat>, mlnorm<fsqmat>. Those classes act identically the only difference is that the internal data are stored either in LD decomposition, choleski decomposition or full matrices, respectively. 253 253 - the same concept is used for enorm, where enorm<chmat> and enorm<fsqmat> are also possible. In this particular use, these objects are equivalent. In specific situation, e.g. Kalman filter implemented on Choleski decomposition (bdm::KalmanCh), only enorm<chmat> is approprate. 254 254 - class 'mprod' represents the chain rule of probability. Attribute \c mpdfs of its configuration structure is a list of conditional densities. Conditional density \f$ f(a|b)\f$ is represented by class \c mpdf and its offsprings. Class \c RV is used to describe both variables before conditioning (field \c rv ) and after conditioning sign (field \c rvc). -
library/doc/tutorial/arx_ui.dox
r659 r661 2 2 \page arx_ui Running experiment \c estimator with ARX data fields 3 3 4 The experiment \ refestimator.cpp can be run either on command line, or as a mex file in Matlab.4 The experiment \c estimator.cpp can be run either on command line, or as a mex file in Matlab. 5 5 6 6 \section cmd Command Line … … 11 11 The structure is interpreted by application \c estimator, which looks for fields: 12 12 <dl> 13 <dt>system</dt><dd> description of a Data Source generating Data. The structure must by UI with \c type="DS_offspring". In our example, it is of type"ArxDS" which is parsed by bdm::UIArxDS UIbuilder generating a Data Source simulating ARX process.</dd>14 <dt>estimator</dt> <dd> description of a Baysian model used to estimate parameters of the data model. In this case, it is of type"ARXest" which is parsed by bdm::UIARX UIbuilder generating Bayesian estimator of autoregressive processess.</dd>15 <dt>logger</dt><dd> description of a way how to store results. UI is of \c type="logger_offspring". In this case, it is of class "dirfilelog" which is parsed by bdm::UIdirfilelog which generates object storing data in directory specified by dirname="" field in fileformat understood by program kst.</dd>13 <dt>system</dt><dd> description of a Data Source generating Data. The structure must by UI with \c class="DS_offspring". In our example, it is of class "ArxDS" which is parsed by bdm::UIArxDS UIbuilder generating a Data Source simulating ARX process.</dd> 14 <dt>estimator</dt> <dd> description of a Baysian model used to estimate parameters of the data model. In this case, it is of class "ARXest" which is parsed by bdm::UIARX UIbuilder generating Bayesian estimator of autoregressive processess.</dd> 15 <dt>logger</dt><dd> description of a way how to store results. UI is of \c class="logger_offspring". In this case, it is of class "dirfilelog" which is parsed by bdm::UIdirfilelog which generates object storing data in directory specified by dirname="" field in fileformat understood by program kst.</dd> 16 16 </dl> 17 17 When the application estimator is run with the above code, it produces a directory of data files, which can be displayed by program kst. Expected results are: … … 20 20 21 21 \section mex Matlab mex file 22 The matlab mex file can be run with exactly the same configuration as above. However, when we wish to see the results in Matlab, we may wish to change the logger object to \c type="mexlog" which will store the results in a matlab structure.22 The matlab mex file can be run with exactly the same configuration as above. However, when we wish to see the results in Matlab, we may wish to change the logger object to \c class="mexlog" which will store the results in a matlab structure. 23 23 24 24 The exact configuration file may look as follows: -
library/doc/tutorial/kalman.dox
r272 r661 38 38 \section exa Examples of Use 39 39 40 The classes can be used directly in C++ or via User Info. The latter example is illustrated in file \subpage estimator. A very short example of the former follows:40 The classes can be used directly in C++ or via User Info. The latter example is illustrated in file \subpage user_guide2. A very short example of the former follows: 41 41 42 42 \include kalman_simple.cpp -
library/doc/tutorial/ui.dox
r659 r661 93 93 default values can follow immediately. Imagine, for example, that the first attribute \c ndat is optional. Thereore, the default value is filled in the case that there is not any other in the configuration file (and so #bdm::UI::get method returs \c false). The second atribute, \c prior, is intended to be compulsory. This fact is specified by the last parameter of the templated #bdm::UI::build method. In this case, the method throws an exception if there is not proper data in the configuration file. 94 94 95 The only difference between #bdm::UI::build and #bdm::UI::get method is in the types of variables they are prepared to. The #bdm::UI::build<T> method is used to initialize instances of classes derived from #bdm::root. It allocates them dynamically and return just an pointer to the new instance. This way it is possible even to load instances of inherited classes without aneven knowing about it. Oppositely, all scalar values of types int, double, string, vec, ivec or mat are loaded by the #bdm::UI::get method with a static memory management. It is also capable to load arrays of templated type #itpp::Array<T>.95 The only difference between #bdm::UI::build and #bdm::UI::get method is in the types of variables they are prepared to. The #bdm::UI::build<T> method is used to initialize instances of classes derived from #bdm::root. It allocates them dynamically and return just an pointer to the new instance. This way it is possible even to load instances of inherited classes without aneven knowing about it. Oppositely, all scalar values of types int, double, string, vec, ivec or mat are loaded by the #bdm::UI::get method with a static memory management. It is also capable to load arrays of templated type \c itpp::Array<T>. 96 96 97 97 Saving is much more easier. For all the variable types, use the #bdm::UI::save method.