Skip to content

Commit

Permalink
change kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmjl committed Jul 8, 2019
1 parent 591dd28 commit 7974470
Show file tree
Hide file tree
Showing 8 changed files with 1,729 additions and 940 deletions.
10 changes: 4 additions & 6 deletions notebooks/01a-instructor-probability-simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"* Let's say that a website has a CTR of 50%, i.e. that 50% of people click through. If we picked 1000 people at random from thepopulation, how likely would it be to find that a certain number of people click?\n",
"* Let's say that a website has a CTR of 50%, i.e. that 50% of people click through. If we picked 1000 people at random from the population, how likely would it be to find that a certain number of people click?\n",
"\n",
"We can simulate this using `numpy`'s random number generator.\n",
"\n",
Expand Down Expand Up @@ -755,8 +755,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"In the above, we saw that we could match data-generating processes with binary outcomes to the story of the binomial distribution.\n",
"\n",
"> The Binomial distribution's story is as follows: the number $r$ of successes in $n$ Bernoulli trials with probability $p$ of success, is Binomially distributed. \n",
Expand Down Expand Up @@ -1225,9 +1223,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "bayesian-modelling-tutorial",
"language": "python",
"name": "python3"
"name": "bayesian-modelling-tutorial"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -1239,7 +1237,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.7.3"
},
"toc-autonumbering": true
},
Expand Down
451 changes: 67 additions & 384 deletions notebooks/01a-student-probability-simulation.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions notebooks/01b-instructor-joint-conditional-probability.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "bayesian-modelling-tutorial",
"language": "python",
"name": "python3"
"name": "bayesian-modelling-tutorial"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -566,7 +566,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
174 changes: 33 additions & 141 deletions notebooks/01b-student-joint-conditional-probability.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -83,29 +83,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.2456\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEBCAYAAACXArmGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAEv9JREFUeJzt3X2QXXV9x/H3bhIhmgcwLEMQQ2sxX6iOxPLgTBGkhTpDfaCOIJXIgw5gBuloizJakgpWO30iWKqxDsjEmZRCC1VLIU5HdCQWUVHBjpjvMB2MxqQlE+kksQaSbPrHPfvjumb3nnv37j279P2aYdj7Pb+z53vP/nI/95yz9+zQwYMHkSQJYLjpBiRJM4ehIEkqDAVJUmEoSJIKQ0GSVBgKkqTCUJAkFYaCJKkwFCRJhaEgSSoMBUlSMbfpBmo4DDgN2A4caLgXSZot5gBLgW8Bz9RdaTaEwmnApqabkKRZ6kzga3UHz4ZQ2A7w9NM/Y3S0tzu6LlmygJ079/S1qX6wr+7YV3fsqzvPt76Gh4c48sgXQfUaWtdsCIUDAKOjB3sOhbH1ZyL76o59dce+uvM87aur0+5eaJYkFYaCJKkwFCRJhaEgSSoMBUlSYShIkgpDQZJU1PqcQkR8BTga2FeV3g38GrAamAd8PDM/WY09F1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xOa6L2ciPDvvTV5h3A5zPzqbaep3N/ddLU/Kqlgfk1qQbnV12NzK+IeAVwH/CBzHyibVFj82s2HylspXUHwDHjb7A30fKngMURMXaP8aXUuzFfv/oiIpbSuh3494ArqtriiPjDtmFDQD8vtk3aV0Qsi4h3jdv+vk7rTXdfbX4PuHPswQD2VydNza+OGppfnXpqan7VNfD5FRFnAA8AHxwL7jaNza/ZHApfAs6JiJGIeCGtG+x9cWxhZm4B9lY7HuASYGN1/m4TcFFVvxTYOKi+qh/mvcA/Zub7MnMs9fcA11UXxQCuofVObyB9AT8H/jIifjUihmidg/3cRPtxgH1R9XMK8PW28nTvr0k1OL8m1eD86qSp+dVRE/MrIl5K67TexZl55/jlTc6vWRsKE91gLyLuj4hTq2ErgZsjYjOwALilql9N67dcHqd1O+/VA+zrzbTOqV4QEY9W/92WmQdonVf8VET8gNYkvW6CzfS9r8zcAbyb1gtK0npndFO1+kT7cdr7qoaNAM9m5t629aZ1f02k6flVo69G5lenvpqaX536qh42Mb/eDxwOrG37Oa2aCfPLG+JJkopZe6QgSeo/Q0GSVBgKkqTCUJAkFYaCJKkwFCRJhaEgSSoMBUlS8X/Ba4xyC34TQAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Solution: Calculate P(A,B)\n",
"x_0 = np.random.binomial(2, 0.5, 10000)\n",
Expand All @@ -118,20 +98,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.2523537"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Solution: Calculate P(A)P(B)\n",
"x_1 = np.random.binomial(1, 0.5, 10000)\n",
Expand Down Expand Up @@ -167,20 +136,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.724891534007516"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Import data & store lengths in a pandas series\n",
"df_12 = pd.read_csv('../data/finch_beaks_2012.csv')\n",
Expand All @@ -201,20 +159,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.7239874466"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Calculate P(A)P(B) using resampling methods\n",
"n_samples = 100000\n",
Expand All @@ -232,20 +179,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.7242"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Calculate P(A,B) using resampling methods\n",
"n_samples = 100000\n",
Expand Down Expand Up @@ -294,41 +230,19 @@
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.8514056224899599"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Q1 Answer\n",
"___"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.6942148760330579"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Q2 Answer\n",
"df_fortis = df_12.loc[df_12['species'] == 'fortis']\n",
Expand All @@ -337,20 +251,9 @@
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Q3 Answer\n",
"df_scandens = df_12.loc[df_12['species'] == 'scandens']\n",
Expand Down Expand Up @@ -415,7 +318,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -428,7 +331,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -440,20 +343,9 @@
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0.33718559])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# how many of those +ve tests were for users?\n",
"_____ / (______ + _________)"
Expand Down Expand Up @@ -555,9 +447,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "bayesian-modelling-tutorial",
"language": "python",
"name": "python3"
"name": "bayesian-modelling-tutorial"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -569,7 +461,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions notebooks/02-instructor-parameter-estimation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "bayesian-modelling-tutorial",
"language": "python",
"name": "python3"
"name": "bayesian-modelling-tutorial"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -328,7 +328,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 7974470

Please sign in to comment.