ericzy89 / bnt

Automatically exported from code.google.com/p/bnt
0 stars 0 forks source link

inference error ; help me please #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
hi 
Email Address::::   rafe.torabi@gmail.com

help me ; help me plz I write code for Inference but it have error below::: 

??? Error using ==> subsindex Function 'subsindex' is not defined for values of 
class 'cell'. 

Error in ==> discrete_CPD.convert_to_table at 14 T = CPT(index{:}); 

Error in ==> discrete_CPD.convert_to_pot at 20 

T = convert_to_table(CPD, domain, evidence); 

Error in ==> jtree_inf_engine.enter_evidence at 57 

pot{n} = convert_to_pot(bnet.CPD{e}, pot_type, fam(:), evidence); 

Error in ==> Rafe_inference at 116 engine,loglik? = 
enter_evidence(engine,evidence); 

my code is ::::: 

clear all 

clc 

A?=xlsread('E:\DATA MINING\final_cut.xlsx'); 

N=6; 

dag=zeros(N,N); 

AS=1;AM=2;CC=3;SC=4;VT=5;DA=6; 

dag(3:6,AS)=1;dag(2,3)=1;dag(3,4)=1; 

discrete_nodes=1:N; 

node_sizes=3 9 9 21 10?; 

onodes=2:6; 

bnet=mk_bnet(dag,node_sizes,'observed',onodes); 

draw_graph(bnet.dag); 

bnet.CPD{AS}=tabular_CPD(bnet,AS); 

bnet.CPD{AM}=tabular_CPD(bnet,AM); 

bnet.CPD{CC}=tabular_CPD(bnet,CC); 

bnet.CPD{SC}=tabular_CPD(bnet,SC); 

bnet.CPD{VT}=tabular_CPD(bnet,VT); 

bnet.CPD{DA}=tabular_CPD(bnet,DA); 

TrainingSamples?=cell(N,size(A,1)); 

for i = 1 : size(A,1) 

TrainingSamples?(1,i)={A(i,1)'}; 
TrainingSamples?(2,i)={A(i,2)'}; 
TrainingSamples?(3,i)={A(i,3)'}; 
TrainingSamples?(4,i)={A(i,4)'}; 
TrainingSamples?(5,i)={A(i,5)'}; 
TrainingSamples?(6,i)={A(i,6)'}; 
end 

bnet=learn_params(bnet,TrainingSamples?); 

engine = jtree_inf_engine(bnet); 

evidence = cell(1,N); 

evidence{AM} = {A(i,2)'}; 

evidence{CC} = {A(i,3)'}; 

evidence{SC} = {A(i,4)'}; 

evidence{VT} = {A(i,5)'}; 

evidence{DA} = {A(i,6)'}; 

engine,loglik? = enter_evidence(engine,evidence); 

marg = marginal_nodes(engine, AS); 

Original issue reported on code.google.com by rafe.tor...@gmail.com on 19 Sep 2011 at 4:55

Attachments:

GoogleCodeExporter commented 9 years ago
help me plz

Original comment by rafe.tor...@gmail.com on 19 Sep 2011 at 4:57

GoogleCodeExporter commented 9 years ago
you are trying this inference on which example??? can you share it

Original comment by dharmesh...@gmail.com on 7 Jan 2015 at 5:32