BDM Use - Merging of probability distributions
Merging is an operation which combines information from many source
pdfs into one, the merger
.
The very basic merger requires that the sources are defined on the same variables.
Matlab class mexMerger
All mergers in Matlab are derived from a class mexMerger which has only the list of sources
, their weights
, the resulting pdf, the merger
, and operations merge() and validate().
classdef mexMerger properties %> weights of the merged densities weights %> source pdfs to be merged sources %> merged density - any pdf understood by epdf_* functions merger end methods function obj=validate(obj) % e.g. check if all sources are compatible end %> Merge sources into the merger function obj=merge(obj) % transform old estimate into new estimate end end end
Validate has the same meaning as in previous chapters, i.e. it is called before any use of the class to check that all elements has been set-up correctly.
Except form that, only few technical functions are needed for integration with C++ classes in BDM, see mexMerger.
mexMErger is an abstract class, which has no operation defined. In order to achieve some functionality an offspring need to be defined. An example of one possible offspring is in class mexGaussMergerArit which implements Arithmetic merging of source pdfs which are converted into Gaussians using moment matching.
The offspring only redefines methods validate and merge.
An example how to use this class is in bdmtoolbox/tutorial/merging/merge_mex.m
clear all pdfs % merger M=mexGaussMergerArit; M.weights = [0.5, 0.5]; M.sources = {N1a,Ga}; M=M.validate(); M=M.merge(); figure(1); h=epdf_1dplot(N1a); set(h,'LineStyle','--'); hold on h=epdf_1dplot(Ga); set(h,'LineStyle','--'); epdf_1dplot(M.merger);
For list of all Matlab mergers, see list .
Mergers from BDM
More advanced mergers allowing to merge pdfs on partially overlapping variables are available in BDM, specifically, classes bdm::MergerBase and bdm::merger_mix.
Their use is demonstrated in examples: bdmtoolbox/tutorial/merging/merge_grid.m and merge_mix.m, respectively.
Generated on Fri Aug 27 16:55:20 2010 for bdmtoolbox by
![doxygen](doxygen.png)