Daniel@0: function [bnet, names] = mk_bat_dbn() Daniel@0: % MK_BAT_DBN Make the BAT DBN Daniel@0: % [bnet, names] = mk_bat_dbn() Daniel@0: % See Daniel@0: % - Forbes, Huang, Kanazawa and Russell, "The BATmobile: Towards a Bayesian Automated Taxi", IJCAI 95 Daniel@0: % - Boyen and Koller, "Tractable Inference for Complex Stochastic Processes", UAI98. Daniel@0: Daniel@0: names = {'LeftClr', 'RightClr', 'LatAct', 'Xdot', 'InLane', 'FwdAct', ... Daniel@0: 'Ydot', 'Stopped', 'EngStatus', 'FBStatus', ... Daniel@0: 'LeftClrSens', 'RightClrSens', 'TurnSignalSens', 'XdotSens', 'YdotSens', ... Daniel@0: 'FYdotDiffSens', 'FclrSens', 'BXdotSens', 'BclrSens', 'BYdotDiffSens', ... Daniel@0: 'SensorValid', 'FYdotDiff', 'FcloseSlow', 'Fclr', 'BXdot', 'BcloseFast', 'Bclr', 'BYdotDiff'}; Daniel@0: ss = length(names); Daniel@0: Daniel@0: intrac = {... Daniel@0: 'LeftClr', 'LeftClrSens'; Daniel@0: 'RightClr', 'RightClrSens'; Daniel@0: 'LatAct', 'TurnSignalSens'; 'LatAct', 'Xdot'; Daniel@0: 'Xdot', 'XdotSens'; Daniel@0: 'FwdAct', 'Ydot'; Daniel@0: 'Ydot', 'YdotSens'; 'Ydot', 'Stopped'; Daniel@0: 'EngStatus', 'Ydot'; 'EngStatus', 'FYdotDiff'; 'EngStatus', 'Fclr'; 'EngStatus', 'BXdot'; Daniel@0: 'SensorValid', 'XdotSens'; 'SensorValid', 'YdotSens'; Daniel@0: 'FYdotDiff', 'FYdotDiffSens'; 'FYdotDiff', 'FcloseSlow'; Daniel@0: 'FcloseSlow', 'FBStatus'; Daniel@0: 'Fclr', 'FclrSens'; 'Fclr', 'FcloseSlow'; Daniel@0: 'BXdot', 'BXdotSens'; Daniel@0: 'Bclr', 'BclrSens'; 'Bclr', 'BXdot'; 'Bclr', 'BcloseFast'; Daniel@0: 'BcloseFast', 'FBStatus'; Daniel@0: 'BYdotDiff', 'BYdotDiffSens'; 'BYdotDiff', 'BcloseFast'}; Daniel@0: [intra, names] = mk_adj_mat(intrac, names, 1); Daniel@0: Daniel@0: Daniel@0: interc = {... Daniel@0: 'LeftClr', 'LeftClr'; 'LeftClr', 'LatAct'; Daniel@0: 'RightClr', 'RightClr'; 'RightClr', 'LatAct'; Daniel@0: 'LatAct', 'LatAct'; 'LatAct', 'FwdAct'; Daniel@0: 'Xdot', 'Xdot'; 'Xdot', 'InLane'; Daniel@0: 'InLane', 'InLane'; 'InLane', 'LatAct'; Daniel@0: 'FwdAct', 'FwdAct'; Daniel@0: 'Ydot', 'Ydot'; Daniel@0: 'Stopped', 'Stopped'; Daniel@0: 'EngStatus', 'EngStatus'; Daniel@0: 'FBStatus', 'FwdAct'; 'FBStatus', 'LatAct'}; Daniel@0: inter = mk_adj_mat(interc, names, 0); Daniel@0: Daniel@0: obs = {'LeftClrSens', 'RightClrSens', 'TurnSignalSens', 'XdotSens', 'YdotSens', 'FYdotDiffSens', ... Daniel@0: 'FclrSens', 'BXdotSens', 'BclrSens', 'BYdotDiffSens'}; Daniel@0: Daniel@0: for i=1:length(obs) Daniel@0: onodes(i) = strmatch(obs{i}, names); %stringmatch(obs{i}, names); Daniel@0: end Daniel@0: onodes = sort(onodes); Daniel@0: Daniel@0: dnodes = 1:ss; Daniel@0: ns = 2*ones(1,ss); % binary nodes Daniel@0: bnet = mk_dbn(intra, inter, ns, 'discrete', dnodes, 'observed', onodes, 'eclass2', (1:ss)+ss); Daniel@0: Daniel@0: % make rnd params Daniel@0: for i=1:2*ss Daniel@0: bnet.CPD{i} = tabular_CPD(bnet, i); Daniel@0: end Daniel@0: