Question about calling updateBeliefs()

The engine.
Post Reply
rhosseini
Posts: 4
Joined: Wed Dec 27, 2017 10:00 pm

Question about calling updateBeliefs()

Post by rhosseini » Thu Dec 28, 2017 7:04 pm

Dear SMILE team,

I am using SMILE for building a Bayesian network to model the student knowledge. There are three types of nodes in my network: item nodes [representing questions that the student would attempt], concept nodes [representing concepts that are in the questions], and noisy AND gates for each item. The parent of each item is its corresponding noisy AND gate and the parents of each noisy AND gate are the concepts that are in the item [the number of concepts ranges from 1-8 (inclusive)].

I want to update the beliefs in the network when I have an evidence from the student, that is when the result of the student attempt on an item is available. What I first did was to call updateBeliefs() after setting the evidence for the item that the student attempted. After that, when I wanted to get the value of an item node, I received an SMILEException: Value not valid.

The above exception disappears when I call updateBeliefs() twice. Yet, I don't understand why I need two calls to updateBeliefs() after receiving an evidence for an item. I'd be grateful if you could explain to me how many times updateBeliefs() should be called in a network that has the same structure as my network, and why?

Thank you in advance for your time and help.

Best,
Roya

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: Question about calling updateBeliefs()

Post by shooltz[BayesFusion] » Thu Dec 28, 2017 7:13 pm

What I first did was to call updateBeliefs() after setting the evidence for the item that the student attempted. After that, when I wanted to get the value of an item node, I received an SMILEException: Value not valid.

The above exception disappears when I call updateBeliefs() twice.
One updateBeliefs() call should be enough. Can you post your code and network here?

rhosseini
Posts: 4
Joined: Wed Dec 27, 2017 10:00 pm

Re: Question about calling updateBeliefs()

Post by rhosseini » Thu Dec 28, 2017 8:41 pm

Thank you for your answer.
I attached my Java class and the network. Please change the extension of the Java file, it should be Main.java.

Best,
Roya
Attachments
Net_LearnedBySMILE_BN.xdsl
(174.74 KiB) Downloaded 266 times
Main.txt
(1.33 KiB) Downloaded 165 times

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: Question about calling updateBeliefs()

Post by shooltz[BayesFusion] » Thu Dec 28, 2017 8:50 pm

The clearEvidence call which you perform immediately after updateBeliefs may invalidate some or all of the calculated probabilities. If you need to retract the evidence, do so after retrieving node values.

rhosseini
Posts: 4
Joined: Wed Dec 27, 2017 10:00 pm

Re: Question about calling updateBeliefs()

Post by rhosseini » Thu Dec 28, 2017 9:39 pm

Thank you so much for your answer and help.
Is net.clearEvidence() function necessary at all? and what would happen if I don't clear evidence after belief update?

Best,
Roya

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: Question about calling updateBeliefs()

Post by shooltz[BayesFusion] » Thu Dec 28, 2017 10:31 pm

what would happen if I don't clear evidence after belief update?
The evidence set on the specific node would remain intact (and would influence the results of the subsequent updateBeliefs calls).

You may consider Network.clearAllEvidence as an alternative.

rhosseini
Posts: 4
Joined: Wed Dec 27, 2017 10:00 pm

Re: Question about calling updateBeliefs()

Post by rhosseini » Fri Dec 29, 2017 3:49 pm

Thank you so much for your answer and help. My problem is solved now.

Best,
Roya

Skipla
Posts: 5
Joined: Sat Mar 14, 2015 12:50 pm

Re: Question about calling updateBeliefs()

Post by Skipla » Sun Dec 31, 2017 9:02 am

Hi guys,
thanks for that discussion.
QQ, what is the difference between
Network.clearAllEvidence
and net.clearEvidence ?

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: Question about calling updateBeliefs()

Post by shooltz[BayesFusion] » Thu Jan 04, 2018 10:25 am

QQ, what is the difference between
Network.clearAllEvidence
and net.clearEvidence ?
There's no difference. The 'net' in 'net.clearAllEvidence' refers to the local variable in the code posted earlier in this thread. Network.clearAllEvidence is just a general 'ClassName.methodName' notation.

Post Reply