diff --git a/math-for-ml/03_probability/exercises.ipynb b/math-for-ml/03_probability/extras.ipynb similarity index 97% rename from math-for-ml/03_probability/exercises.ipynb rename to math-for-ml/03_probability/extras.ipynb index 1557e5b7..7e304133 100644 --- a/math-for-ml/03_probability/exercises.ipynb +++ b/math-for-ml/03_probability/extras.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Math4ML Part III: Probability" + "# Math4ML Part III: Probability - Extras" ] }, { @@ -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", @@ -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" ] }, { @@ -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]);" ] }, { @@ -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))" @@ -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)" ] diff --git a/math-for-ml/03_probability/__init__.py b/math-for-ml/03_probability/utils/__init__.py similarity index 100% rename from math-for-ml/03_probability/__init__.py rename to math-for-ml/03_probability/utils/__init__.py diff --git a/math-for-ml/03_probability/clt.py b/math-for-ml/03_probability/utils/clt.py similarity index 100% rename from math-for-ml/03_probability/clt.py rename to math-for-ml/03_probability/utils/clt.py diff --git a/math-for-ml/03_probability/mle.py b/math-for-ml/03_probability/utils/mle.py similarity index 100% rename from math-for-ml/03_probability/mle.py rename to math-for-ml/03_probability/utils/mle.py