Skip to content

trying to solve cookie3.py from first edition #5

@LeonardoReyes

Description

@LeonardoReyes

Hello,

I have been trying to pull off exercise 2.1 to create the cookie example without replacement but after failing miserably I checked the GIT repository for ThinkBayes2, and found a code with the solution for the second edition....

To my surprise I saw that I was on the correct track, however when trying to re-write the solution for the first version of ThinkBayes I still could not make it work...

if I use the following to set the hypos

bowl1=dict(vanilla=30,chocolate=10)
bowl2=dict(vanilla=20,chocolate=20)
pmf=Cookie([bowl1, bowl2])

I get:

TypeError: unhashable type: 'dict'

If I use the following (as cookie3.py in ThinkBayes2 )

bowl1=Hist(dict(vanilla=30,chocolate=10))
bowl2=Hist(dict(vanilla=20,chocolate=20)) 

I get :

AttributeError: 'Hist' object has no attribute 'Normalize'

I really want to see the solution to this, any hint or suggestion will be really appreciated!

Many thanks!

Leo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions