Changeset 700 for applications

Show
Ignore:
Timestamp:
11/04/09 22:54:58 (15 years ago)
Author:
smidl
Message:

Making tutorial/userguide example work again (changes of mpdf and bayes)

Location:
applications
Files:
1 removed
9 modified
1 moved

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/mex/estimator.cpp

    r685 r700  
    4848 */ 
    4949 
    50 #include "estim/arx.h" 
    51 #include "stat/emix.h" 
    52 #include "base/datasources.h" 
    53 #include "base/loggers.h" 
    54 #include "estim/particles.h" 
    55 #include "estim/kalman.h" 
     50#include <estim/arx.h> 
     51#include <stat/emix.h> 
     52#include <base/datasources.h> 
     53#include <base/loggers.h> 
     54#include <estim/particles.h> 
     55#include <estim/kalman.h> 
    5656 
    5757//#include "mex_datasource.h" 
     
    6161#ifdef MEX 
    6262#include <itpp/itmex.h> 
    63 #include "mex/mex_BM.h" 
    64 #include "mex/mex_logger.h" 
    65 #include "mex/mex_datasource.h" 
     63#include <mex/mex_BM.h> 
     64#include <mex/mex_logger.h> 
     65#include <mex/mex_datasource.h> 
    6666 
    6767void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { 
     
    120120        Array<shared_ptr<BM> > Es; 
    121121        UI::get ( Es,Cfg, "estimators" ); 
    122         long Ndat=10; 
     122        int Ndat=10; 
    123123        if ( Cfg.exists ( "experiment" ) ) { 
    124                 if ( Cfg.lookupValue ( "experiment.ndat",Ndat ) ) { 
     124                if ( Cfg.getRoot().lookupValue ( "experiment.ndat",Ndat ) ) { 
    125125                        bdm_assert ( Ndat<=Ds->max_length(), "Data source has less data then required" ); 
    126126                }; 
  • applications/bdmtoolbox/mex/merger.cpp

    r685 r700  
    5858#endif 
    5959        // Sources 
    60         Array<shared_ptr<mpdf> >  Sources; 
     60        Array<shared_ptr<pdf> >  Sources; 
    6161        UI::get(Sources, Cfg, "Sources", UI::compulsory); 
    6262        shared_ptr<merger_base> Merger = UI::build<merger_base> ( Cfg, "Merger" ); 
  • applications/bdmtoolbox/mex/simulator.cpp

    r676 r700  
    3939 */ 
    4040 
    41 #include "estim/arx.h" 
    42 #include "stat/emix.h" 
    43 #include "base/datasources.h" 
    44 #include "base/loggers.h" 
     41#include <estim/arx.h> 
     42#include <stat/emix.h> 
     43#include <base/datasources.h> 
     44#include <base/loggers.h> 
    4545 
    4646//#include "mex_datasource.h" 
     
    104104 
    105105        shared_ptr<DS> Ds = UI::build<DS> ( Cfg, "system" ); 
    106         long Ndat=10; 
     106        int Ndat=10; 
    107107        if ( Cfg.exists ( "experiment" ) ) { 
    108108                if ( Cfg.lookupValue ( "experiment.ndat",Ndat ) ) { 
  • applications/bdmtoolbox/tutorial/merging/pdfs.m

    r568 r700  
    3838    'rv', ab); 
    3939Gb_a=struct('class','mgamma',  'beta',2,  'k',1,  'rv',b,  'rvc',a); % f(b|a) 
    40 Ga_ =struct('class','mepdf','epdf',Ga); % convert f(a) to f(a|) 
    41 Gba = struct('class','mprod',  'mpdfs',{{Gb_a,Ga_}}); 
     40Gba = struct('class','mprod',  'pdfs',{{Gb_a,Ga}}); 
    4241 
    4342pd.Ga=Ga; 
  • applications/bdmtoolbox/tutorial/userguide/arx_basic_example.m

    r631 r700  
    11% load data created by the MpdfDS_example 
    2 load mpdfds_results 
     2load pdfds_results 
    33 
    44DS.class   = 'MemDS'; 
     
    1717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    1818% plot results 
    19 ndat = size(M.u,1); 
     19ndat = size(M.DS_u,1); 
    2020 
    2121subplot(1,2,1); 
    2222hold off 
    23 plot((true_theta' *ones(1,ndat))','-.'); 
    24 title(' Regression parameters \theta') 
    25 hold on 
    26 plot(M.mean_theta(1:ndat,:)); 
    27 co = get(gca,'ColorOrder'); 
    28 for i=1:size(M.mean_theta,2) 
    29     ind =1:10:ndat; 
    30     h=errorbar(ind,M.mean_theta(ind,i),... 
    31     M.mean_theta(ind,i)-M.lb_theta(ind,i),M.mean_theta(ind,i)-M.ub_theta(ind,i),'.'); 
    32     set(h,'color',co(i,:)); 
    33 end 
    34  
     23plotestimates(true_theta, ... 
     24    M.Est0_apost_mean_theta, ... 
     25    M.Est0_apost_lb_theta, ... 
     26    M.Est0_apost_ub_theta); 
    3527set(gca,'YLim',[-1.5,1]); 
    3628 
    3729subplot(1,2,2); 
    3830hold off 
    39 plot(true_R*ones(1,ndat),'-.'); 
     31plotestimates(true_R, ... 
     32    M.Est0_apost_mean_r, ... 
     33    M.Est0_apost_lb_r, ... 
     34    M.Est0_apost_ub_r); 
     35 
    4036title('Variance parameters r') 
    41 hold on 
    42 plot(M.mean_r(1:ndat,:)); 
    43 co = get(gca,'ColorOrder'); 
    44 ind =1:10:ndat; 
    45 for i=1:size(M.mean_r, 2) 
    46     h=errorbar(ind,M.mean_r(ind,i),... 
    47     M.mean_r(ind,i)-M.lb_r(ind,i),M.mean_r(ind,i)-M.ub_r(ind,i),'.'); 
    48     set(h,'color',co(i,:)); 
    49 end 
  • applications/bdmtoolbox/tutorial/userguide/arx_selection_example.m

    r631 r700  
    11% load data created by the MpdfDS_example 
    2 load mpdfds_results 
     2load pdfds_results 
    33 
    44DS.class   = 'MemDS'; 
     
    3030 
    3131%%%% Process results 
    32 lls = [sum(M.A1ll) sum(M.A2ll) sum(M.A3ll)] 
     32lls = [sum(M.A1_ll_ll) sum(M.A2_ll_ll) sum(M.A3_ll_ll)] 
    3333 
    3434ells=exp(lls-max(lls)); 
  • applications/bdmtoolbox/tutorial/userguide/epdfds_example.m

    r618 r700  
    1212M=simulator(DS,experiment); 
    1313 
    14 M.a 
     14M.DS_a 
  • applications/bdmtoolbox/tutorial/userguide/frg_estim.m

    r661 r700  
    1717%%%%%% Random walk on frg - Dirichlet  
    1818phi_pdf.class = 'mDirich';         % random walk on coefficient phi 
    19 phi_pdf.rv    = RV('phi',2);       % 2D random walk - frg is the first element 
     19phi_pdf.rv    = RV({'phi','1_phi'});       % 2D random walk - frg is the first element 
    2020phi_pdf.k     = 0.01;              % width of the random walk 
    2121phi_pdf.betac = [0.01 0.01];       % stabilizing elememnt of random walk 
     
    2626E.parameter_pdf = phi_pdf;         % Random walk is the parameter evolution model 
    2727E.res_threshold = 1.0;             % resampling parameter 
    28 E.n = 20;                          % number of particles 
     28E.n = 10;                          % number of particles 
    2929E.prior.class = 'eDirich';         % prior on non-linear part 
    3030E.prior.beta  = [2 1]; %  
     
    3636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    3737% plot results 
    38 ndat = size(M.u,1); 
     38ndat = size(M.DS_u,1); 
    3939 
    4040figure(1); 
    4141subplot(2,2,1); 
    42 plotestimates(true_theta, M.MPFmean_theta, M.MPFlb_theta, M.MPFub_theta); 
     42plotestimates(true_theta, M.MPF_apost_mean_theta, M.MPF_apost_lb_theta, M.MPF_apost_ub_theta); 
    4343title(' Regression parameters \theta') 
    4444set(gca,'YLim',[-1.5,1]); 
    4545 
    4646subplot(2,2,2); 
    47 plotestimates(true_R, M.MPFmean_r,M.MPFlb_r,M.MPFub_r); 
     47plotestimates(true_R, M.MPF_apost_mean_r,M.MPF_apost_lb_r,M.MPF_apost_ub_r); 
    4848title('Variance parameters r') 
    4949 
    5050subplot(2,2,3); 
    51 plotestimates(1, M.MPFmean_phi(:,1),M.MPFlb_phi(:,1),M.MPFub_phi(:,1)); 
     51plotestimates(1, M.MPF_apost_mean_phi(:,1),M.MPF_apost_lb_phi(:,1),M.MPF_apost_ub_phi(:,1)); 
    5252title('Forgetting factor') 
    5353 
  • applications/bdmtoolbox/tutorial/userguide/pdfds_example.m

    r631 r700  
    2020DS.class = 'MpdfDS'; 
    2121DS.mpdf.class  = 'mprod'; 
    22 DS.mpdf.mpdfs  = {fy, epdf2mpdf(fu)}; 
     22DS.mpdf.mpdfs  = {fy, fu}; 
    2323DS.init_rv = RVtimes([y,y,y], [-1,-2,-3]); 
    2424DS.init_values = [0.1, 0.2, 0.3]; 
     
    3030 
    3131%%% store results 
    32 Data=[M.y'; M.u']; 
     32Data=[M.DS_y'; M.DS_u']; 
    3333drv = RVjoin([y,u]); 
    3434true_theta=[fy.A fy.const];  
  • applications/pmsm/filters.h

    r686 r700  
    1919 
    2020//! modelling theta as normal random walk with 2pi correction 
    21         class rwtheta: public mpdf_internal<enorm<fsqmat> > { 
     21        class rwtheta: public pdf_internal<enorm<fsqmat> > { 
    2222                double om_hat_dt; 
    2323                double om_var; 
     
    120120                pf->prior_from_set ( set ); 
    121121                pf->resmethod_from_set ( set ); 
    122                 pf->set_model ( rwt,new mpdf() ); 
     122                pf->set_model ( rwt,new pdf() ); 
    123123 
    124124                shared_ptr<RV> rv = UI::build<RV> ( set, "rv", UI::optional );