zero avoidance in discretization apparently does not work properly

The front end.
Post Reply
PCherubini
Posts: 33
Joined: Thu Mar 24, 2022 9:00 am

zero avoidance in discretization apparently does not work properly

Post by PCherubini »

I need zero avoidance in the discretization of some equation nodes with intrinsic (and logically important) zeroes. The option in network preferences works when I push the button "rediscretize":
Screenshot 2025-05-04 alle 11.39.15.png
Screenshot 2025-05-04 alle 11.39.15.png (31.25 KiB) Viewed 57741 times
but as soon as close the node properties windows and I open it again (or as soon as I update the network), the discretizaton is performed again WITHOUT zero avoidance:
Screenshot 2025-05-04 alle 11.42.22.png
Screenshot 2025-05-04 alle 11.42.22.png (32.83 KiB) Viewed 57741 times
Is there a way to set zero avoidance once and for all in a network? thanks
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Re: zero avoidance in discretization apparently does not work properly

Post by shooltz[BayesFusion] »

Your second screenshot shows the CPT with zero avoidance - there are no zeroes.
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Re: zero avoidance in discretization apparently does not work properly

Post by shooltz[BayesFusion] »

One more thing: the zero avoidance will be actually used only if the node equation contains probability distributions. What is the equation of the "Sospetto romp..." node?
PCherubini
Posts: 33
Joined: Thu Mar 24, 2022 9:00 am

Re: zero avoidance in discretization apparently does not work properly

Post by PCherubini »

Sorry, I wrote the other way around what I really meant. I originally meant "I need a node that DOES NOT avoid zeroes (first original image), but even though I deselect zeroavoidance, any time it is rediscretized for updating it avoids zeroes (second original image)". Then I solved the problem (setting the correct choice for zero avoidance, saving, then CLOSING the file, then reopening it, solves the problem), but I managed to recreate it for you, just in case there is an insidious bug to fix.
Instructions to observe the problem on the attached network:
1) when you open the file, the "zero avoidance" should be selected in the preferences
2) set evidence "8" in "total N of glass..." and "6" in "Total N of matching..." (or whatever value under 20), and update the network
3) when you open "N of glass fragments from source on suspect" you should see the discretization with zero avoidance; all right, since zero avoidance was selected
4) now open the preferences and deselect zero avoidance (the correct choice for the situation modeled)
5) open "N of glass fragments from source on suspect", and "rediscretize" it; you should see, correctly "1 0 0 0 ..." in the column "false"; again, this is how it should be
6) now close that node, and update the network again with the same evidence
7) Now re-open the node "N of glass fragments from source to suspect": the "false" column has been rediscretized with zero avoidance; even though zero avoidance was deselected in the preferences! And it happens again and again, you rediscretize it, get the correct not zero avoiding values, close the node, update the network, and when you reopen the node, it is zero avoiding.

If it helps solving the bug: if you save the network set on "not zero avoidance", when you reopen it, it does not avoids zero (correct). But... there's the oppostie problem: if once you have reopened it, you change preferences and select "zero avoidance", it works when rediscretizing the node, but after closing it and updating the network, it goes back to not-zero avoiding values.
Hope this helps.
possible bug on zero avoidance.xdsl
(12.22 KiB) Downloaded 271 times
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Re: zero avoidance in discretization apparently does not work properly

Post by shooltz[BayesFusion] »

We were not able to reproduce your scenario exactly, but I think we know the root cause of the issue.

GeNIe (or, more precisely, SMILE) caches the discretized CPTs for equations. These cached CPTs are not invalidated when zero avoidance flag changes. Therefore, if you update beliefs and discretization was performed, then toggle the 'zero avoidance' option and update beliefs again, the CPT remains the same.

Please note that CPT created in the 'Discretization' node property page is a preview calculated on the copy of the network.

The fix is of course to invalidate discretized CPTs when zero avoidance changes. The next public GeNIe release will contain the fix; if you need a private build with this modification, let us know.
PCherubini
Posts: 33
Joined: Thu Mar 24, 2022 9:00 am

Re: zero avoidance in discretization apparently does not work properly

Post by PCherubini »

Ok, thank you, I can wait for next release.
Post Reply