Skip to content

Example of making a faster python script by using libraries. This example is of a simulation of bayes formula for coinflips.

Notifications You must be signed in to change notification settings

algotjohansson/python-speedup-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python Speedup Example

Example of how a python script can be made faster using Numpy.

This example is a simulation of a problem which can be solved by Bayes formula:

A Coin is biased 70% for head OR tail. It comes from a factory where 60% of coins are biased for tail. Observed sequence: H, H, T, H. What is the probability that the coin is biased for head?

When running 100000 simulations, the normal program took 7.113 seconds wile the optimized program took 0.026 seconds. Making the optimized program 273.6 times faster.

Too see how to solve this problem using Bayes formula, see my youtube video here.

About

Example of making a faster python script by using libraries. This example is of a simulation of bayes formula for coinflips.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages