Skip to content

Commit

Permalink
closes #29, partial #30 for probability, closes #35
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesfrye committed Jun 18, 2021
1 parent 18416b1 commit 3e73860
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Math4ML Part III: Probability"
"# Math4ML Part III: Probability - Extras"
]
},
{
Expand All @@ -24,7 +24,7 @@
"outputs": [],
"source": [
"# allows interactive plotting\n",
"%matplotlib widget \n",
"%matplotlib widget\n",
"\n",
"# importing from standard library\n",
"import random\n",
Expand All @@ -35,9 +35,17 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"if 'google.colab' in str(get_ipython()):\n",
" !git clone --branch \"math4ml/reorg\" \"https://github.com/wandb/edu.git\"\n",
" %cd \"edu/math-for-ml/03_probability\"\n",
"else:\n",
" pass\n",
"\n",
"if \"../\" not in sys.path:\n",
" sys.path.append(\"../\")\n",
"\n",
"# importing course-specific modules\n",
"import util\n",
"import probability as prob"
"import utils"
]
},
{
Expand Down Expand Up @@ -115,8 +123,8 @@
"data = true_sigma * np.random.standard_normal(size=N) + true_mu\n",
"\n",
"\n",
"fitter = prob.mle.make_gauss_fitter(data, true_mu, true_sigma)\n",
"prob.mle.make_interactor(fitter, mu_lims=[-10, 10], sigma_lims=[1e-3, 10]);"
"fitter = utils.mle.make_gauss_fitter(data, true_mu, true_sigma)\n",
"utils.mle.make_interactor(fitter, mu_lims=[-10, 10], sigma_lims=[1e-3, 10]);"
]
},
{
Expand Down Expand Up @@ -276,7 +284,7 @@
"metadata": {},
"outputs": [],
"source": [
"prob.mle.make_plot(data, num_gaussians=5, true_mu=true_mu);\n",
"utils.mle.make_plot(data, num_gaussians=5, true_mu=true_mu);\n",
"\n",
"print(\"The surprise-minimizing estimate for µ is \"+str(np.mean(data)))\n",
"print(\"The value of µ used to generate the data is \"+str(true_mu))"
Expand Down Expand Up @@ -431,7 +439,7 @@
"metadata": {},
"outputs": [],
"source": [
"anim_html = prob.clt.setup_and_run_animation(pmf, iters)\n",
"anim_html = utils.clt.setup_and_run_animation(pmf, iters)\n",
"\n",
"IPython.display.HTML(anim_html)"
]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3e73860

Please sign in to comment.