-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'ConditionalDiscreteDistribution' is not defined #11
Comments
It's been renamed ConditionalProbabilityTable. I'll go fix the examples later today. The renaming was because I fundamentally shifted the way conditional probabilities were calculated (for efficient conversion to joint probabilities) and associated API, and wanted to make sure people were notified somehow, even if only through an error message. Sorry for the inconvenience. The README shows how to set up these new tables in the Monty Hall example. |
Thanks @jmschrei for the quick response 😃 But I find ConditionalProbabilityTable requires of lot of hardcoding compared to ConditionalDiscreteDistribution. # Gender, given survival data
gender = ConditionalProbabilityTable(
[[ 'survive', 'male', 0.0 ],
[ 'survive', 'female', 1.0 ],
[ 'perish', 'male', 1.0 ],
[ 'perish', 'female', 0.0]], [passenger] ) where as ConditionalDiscreteDistribution gender = ConditionalDiscreteDistribution({
'survive' : DiscreteDistribution({ 'male' : 0.0, 'female' : 1.0 }),
'perish' : DiscreteDistribution({ 'male' : 1.0, 'female' : 0.0 })
}, [passenger]) |
It looks to me that ConditionalProbabilityTable is taking less characters. Internally it made a lot more sense to go with the CPT format rather than the CDD format. I can re-add CDDs if you're using them in isolation, but I already tried making them work with Bayes nets to pretty terrible results. The primary issue comes in that marginalizing over variables can get really intense in the tree-like structure nested dictionaries give you, whereas with the vector format it's trivial to marginalize any variable. This is a major component of converting to a joint distribution, necessary when you're using a factor graph to do inference on a Bayes net. |
Yes you are correct! As the number of dependent distributions increase, the tree structure gets complex... Actually I started trying CDD when I couldn't get CPT working in my case https://github.com/fareez-ahamed/pylearn/blob/master/scripts/ex4-titanic-disaster.py This code throws the following error at
|
Okay, I see what the problem is. I was conflating two different cases. I tried to hack together a solution, but I'm not comfortable that it is the optimal one. I will go through the entire distribution scheme I have set up and find a better way to code it. |
Ironically, the way this came about was that I kept running more and more complex Bayes nets, fixing bugs as I went, but didn't go back to check to make sure they still worked on the earlier examples. Moral of the story; always encode unit tests, not examples. |
So this float division by zero is an error in pomegranate or my code is doing something wrong with pomegranate? |
Something wrong with pomegranate. I'm moving this to the other issue. |
I'm trying to use ConditionalDiscreteDistribution according to the examples but getting this error. ConditionalDiscreteDistribution seems to be missing in the repo as well when I was searching for it. Am I missing something?
The text was updated successfully, but these errors were encountered: