Giter Club home page Giter Club logo

bayesmadesimple's People

Contributors

allendowney avatar colcarroll avatar hsm207 avatar pleabargain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bayesmadesimple's Issues

Unable to import empyrical-dist module

I have installed empyrical-dist module using pipenv virtual environment but when I try to run your code 01_cookie.ipynb, it throws an error in the first cell at "from empiricaldist import Pmf" saying "ModuleNotFoundError: No module named 'empiricaldist'". Could you please look into this and confirm this is not an issue with the package itself?

Incorrect solution: Dungeons & Dragons Bonus

First of all, thank you for putting on a great tutorial!

I believe I found bad solution in the cookie-notebook.

Bonus exercise: In Dungeons and Dragons, the amount of damage a goblin can withstand is the sum of two six-sided dice. The amount of damage you inflict with a short sword is determined by rolling one six-sided die.

Suppose you are fighting a goblin and you have already inflicted 3 points of damage. What is your probability of defeating the goblin with your next successful attack?

The provided solution is:

d6 = Pmf()
for x in [1,2,3,4,5,6]:
    d6[x] = 1
d6.normalize()

twice = d6.add_dist(d6)
twice[2] = 0
twice[3] = 0
twice.normalize()

>>> d6.ge_dist(twice)
0.11111111111111109

This implies that Goblin's health should be reduced, due to the 3 damage you already did, by creating the posterior over the Goblin's health with the assumption that it does not have 1-3 health remaining. Clearly this is not correct. The blow means that the Goblin's health must lie in the interval [1, 9], not [4, 12]

The correct solution, I believe, would be:

d6 = Pmf()
for x in [1,2,3,4,5,6]:
    d6[x] = 1
d6.normalize()

twice = d6.add_dist(d6)
goblin_health = twice.copy()

# 3 HP of damage already dealt:
dmg3 = Pmf()
dmg3[3] = 1.
sword = d6.copy().add_dist(dmg3)

>>> sword.ge_dist(goblin_health)
0.5

add_dist failed at statement "twice = d6.add_dist(d6)" in 01_cookie.ipynb

The error:
AttributeError: 'Pmf' object has no attribute 'add_dist'

Looks like you have removed add_dist from the Pmf class in the latest version of the empyrical_dist and that seems to break the code in the notebook.

My questions/requests to you are:

  1. Did you change the empyrical_dist from empiricaldist module? Are they 2 different packages? Is one a later version of the other?
  2. If you have changed the name/code of the module, could you please make necessary changes in the jupyter notebook files as well, so that it is easier for people who are following your lecture on youtube?

Include a `requirements.txt` file

To make it easier for attendees to install the necessary packages it would be nice to include a requirements.txt, e.g.

# requirements.txt
scipy
numpy
matplotlib
pandas

Attendees can then run pip install -r requirement.txt to get the required packages installed.

Can't calculate credible intervals nor quantiles

When I try to do it, I get the following error:

NotImplementedError Traceback (most recent call last)
in
1 for i, b in enumerate(beliefs):
----> 2 print(b.mean(), b.credible_interval(0.9))

c:\users...\appdata\local\programs\python\python36-32\lib\site-packages\empiricaldist\empiricaldist.py in credible_interval(self, p)
716 tail = (1 - p) / 2
717 ps = [tail, 1 - tail]
--> 718 return self.quantile(ps)
719
720 @staticmethod

c:\users...\appdata\local\programs\python\python36-32\lib\site-packages\empiricaldist\empiricaldist.py in quantile(self, ps, **kwargs)
137 :return: float
138 """
--> 139 return self.make_cdf().quantile(ps, **kwargs)
140
141 def choice(self, *args, **kwargs):

c:\users...\appdata\local\programs\python\python36-32\lib\site-packages\empiricaldist\empiricaldist.py in inverse(self, **kwargs)
846 )
847
--> 848 interp = interp1d(self.ps, self.qs, **kwargs)
849 return interp
850

c:\users...\appdata\local\programs\python\python36-32\lib\site-packages\scipy\interpolate\interpolate.py in init(self, x, y, kind, axis, copy, bounds_error, fill_value, assume_sorted)
443 elif kind not in ('linear', 'nearest'):
444 raise NotImplementedError("%s is unsupported: Use fitpack "
--> 445 "routines for other types." % kind)
446 x = array(x, copy=self.copy)
447 y = array(y, copy=self.copy)

NotImplementedError: next is unsupported: Use fitpack routines for other types.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.