annotate toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/mk_mildew_dbn.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function bnet = mk_mildew_dbn()
wolffd@0 2
wolffd@0 3 % DBN for foreacasting the gross yield of wheat based on climatic data,
wolffd@0 4 % observations of leaf area index (LAI) and extension of mildew,
wolffd@0 5 % and knowledge of amount of fungicides used and time of usage.
wolffd@0 6 % From Kjaerulff '95.
wolffd@0 7
wolffd@0 8 Fungi=1; Mildew=2; LAI=3; Precip=4; Temp=5; Micro=6; Solar=7; Photo=8; Dry=9;
wolffd@0 9 n = 9;
wolffd@0 10 intra = zeros(n,n);
wolffd@0 11 intra(Mildew, LAI)=1;
wolffd@0 12 intra(LAI,[Micro Photo])=1;
wolffd@0 13 intra(Precip,Micro)=1;
wolffd@0 14 intra(Temp,[Micro Photo])=1;
wolffd@0 15 intra(Solar,Photo)=1;
wolffd@0 16 intra(Photo,Dry)=1;
wolffd@0 17
wolffd@0 18 inter = zeros(n,n);
wolffd@0 19 inter(Fungi,Mildew)=1;
wolffd@0 20 inter(Mildew,Mildew)=1;
wolffd@0 21 inter(LAI,LAI)=1;
wolffd@0 22 inter(Micro,Mildew)=1;
wolffd@0 23 inter(Dry,Dry)=1;
wolffd@0 24
wolffd@0 25 ns = 2*ones(1,n);
wolffd@0 26 bnet = mk_dbn(intra, inter, ns, 'observed', [Photo]);
wolffd@0 27
wolffd@0 28 for e=1:max(bnet.equiv_class(:))
wolffd@0 29 i = bnet.rep_of_eclass(e);
wolffd@0 30 bnet.CPD{e} = tabular_CPD(bnet,i);
wolffd@0 31 end