MaxHalford / sorobn

🧮 Bayesian networks in Python
https://sorobn.streamlit.app
MIT License
234 stars 34 forks source link

Order of the variables in an event #20

Closed lucamcwood closed 2 years ago

lucamcwood commented 2 years ago

Dear Max, Thank you for the Hedgehog implementation, we are currently using it for some exercise classes at the university of Linz. We discovered a strange behavior in the "bn.predict_proba(event)" method. More precisely the calculated probabilities change if we sort the random variables in the event differently: the correct probability is given as an output only if the random variables in the event are sorted in an alphabetic order. This issue is not present in the "bn.query()" method which works great!

Do you have already noticed this issue? Thanks for the support!

MaxHalford commented 2 years ago

Thanks for reaching @lucamcwood, it's a pleasure to know you're making use of this library. Especially for education purposes.

I will take a look at this bug this evening (I'm in the US right now). In the meantime, it would help if you can provide a minimal reproducible example. If not I'll try to reproduce this behavior myself.

Kind regards.

MaxHalford commented 2 years ago

Ok I reproduced the issue and just fixed it! I even added a unit test to make sure this silly bug never happens again. I invite you to reinstall the library and make sure it works on your end.

Sorry for the frustration this may have caused :)

lucamcwood commented 2 years ago

Thank you so much! Best regards