Why do I give the code away? - I was hoping for a Linux-style effect, whereby people would contribute their own Matlab code so that the package would grow. With a few exceptions, this has not happened, although several people have provided bug-fixes (see the acknowledgements). Perhaps the Open Bayes Project will be more succesful in this regard, although the evidence to date is not promising.
- Knowing that someone else might read your code forces one to document it properly, a good practice in any case, as anyone knows who has revisited old code. In addition, by having many "eye balls", it is easier to spot bugs.
- I believe in the concept of reproducible research. Good science requires that other people be able to replicate your experiments. Often a paper does not give enough details about how exactly an algorithm was implemented (e.g., how were the parameters chosen? what initial conditions were used?), and these can make a big difference in practice. Hence one should release the code that was actually used to generate the results in one's paper. This also prevents re-inventing the wheel.
- I was fed up with reading papers where all people do is figure out how to do exact inference and/or learning in a model which is just a trivial special case of a general Bayes net, e.g., input-output HMMs, coupled-HMMs, auto-regressive HMMs. My hope is that, by releasing general purpose software, the field can move on to more interesting questions. As Alfred North Whitehead said in 1911, "Civilization advances by extending the number of important operations that we can do without thinking about them."
|
cool~
very wise article.
Thanks!
thank you
thank you very much!
It's very helpful
Nothing to add Bravo Monsieur!!
thank you
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);
I admire your comments on reproducible research.
I couldn't agree more!