From 3c7a2638dd87c64dc411c96b0bce2869a1c87fc4 Mon Sep 17 00:00:00 2001 From: arjunsavel Date: Wed, 8 Nov 2023 13:37:32 -0500 Subject: [PATCH] note units of max size --- docs/pages/optimizing.ipynb | 116 +++++++++++++++++++++++++++++------- 1 file changed, 96 insertions(+), 20 deletions(-) diff --git a/docs/pages/optimizing.ipynb b/docs/pages/optimizing.ipynb index 850b72a..aac5ffe 100644 --- a/docs/pages/optimizing.ipynb +++ b/docs/pages/optimizing.ipynb @@ -3,7 +3,11 @@ { "cell_type": "markdown", "id": "c72aa35f-e048-4b21-8dbb-543f2784a7c1", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "# Optimizing fits" ] @@ -11,7 +15,11 @@ { "cell_type": "markdown", "id": "ce5e8765-93d8-469d-b489-ed33402fd4c9", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "At this point, we know how to fit functions to opacity dependence as a function of temperature, pressure, and wavelength. The question remains: Is our fit as good as it can be?\n", "\n", @@ -25,7 +33,11 @@ { "cell_type": "markdown", "id": "a0eb8ec2-c1e6-431d-a51e-d3de9c363f2c", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "## Setting up the fit" ] @@ -34,7 +46,11 @@ "cell_type": "code", "execution_count": 1, "id": "465e0289-4f8f-4785-9227-1291fbdd70ca", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "import numpy as np\n", @@ -58,7 +74,11 @@ "cell_type": "code", "execution_count": 2, "id": "9d382ad1-9356-41ad-95ec-175be6835eff", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stderr", @@ -88,7 +108,11 @@ "cell_type": "code", "execution_count": 3, "id": "d1d67aca-ae6f-4597-8181-c989d738620c", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "data": { @@ -124,7 +148,11 @@ { "cell_type": "markdown", "id": "aa5a4c0f-bcaf-4bae-8529-12ddb3ed2ac8", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "Things look pretty good — let's check to be sure." ] @@ -133,7 +161,11 @@ "cell_type": "code", "execution_count": 4, "id": "287fa918-89a3-4e35-9839-edcee1167d8d", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -184,7 +216,11 @@ { "cell_type": "markdown", "id": "ff68ce2e-2524-493a-aa9b-55be0531a0d8", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "## Optimization" ] @@ -193,7 +229,11 @@ "cell_type": "code", "execution_count": 5, "id": "923edfe8-6c3f-4612-9025-9fbfb9ade1a8", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "optimizer = Optimizer(fitter)" @@ -202,7 +242,11 @@ { "cell_type": "markdown", "id": "b3dadac9-7d03-4530-84e6-e9ac09fbfb44", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "Next, we need to restrict how many hyperparameters the `Optimizer` tests. \n", "\n", @@ -213,16 +257,24 @@ "cell_type": "code", "execution_count": 6, "id": "e193f1ca-4488-4526-95bd-9cb4c72d35d6", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ - "max_size = 1.6" + "max_size = 1.6 # in KB" ] }, { "cell_type": "markdown", "id": "2be5ac80-23d4-434c-a850-8116f724f703", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "In addition to this parameter, we need to set the `max_evaluations` parameter. This parameter sets how many models the `Optimizer` tests, essentially setting how long the optimization takes. For the purposes of this tutorial, we'll set a relatively low number. Note that this is an upper bound — setting `max_evaluations = 8`, for instance, will only run 2 model evaluations." ] @@ -231,7 +283,11 @@ "cell_type": "code", "execution_count": 7, "id": "55ceac04-e41e-489f-8e2d-75862552eb39", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "max_evaluations = 16" @@ -240,7 +296,11 @@ { "cell_type": "markdown", "id": "a11cdfa2-db6f-4eff-8967-fd718dd7d5fa", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "Now, it's time to run the optimizer!" ] @@ -249,7 +309,11 @@ "cell_type": "code", "execution_count": 8, "id": "9850ba7d-1ad9-4db4-a53c-004af1f3995d", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -291,7 +355,11 @@ { "cell_type": "markdown", "id": "a0f11df9-2c38-43d7-aad1-f2966d21746e", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "This took a couple of minutes on a laptop. Let's look at those best-fit parameters." ] @@ -300,7 +368,11 @@ "cell_type": "code", "execution_count": 9, "id": "ff63a90b-a667-4779-838c-0dcaa918c698", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "data": { @@ -320,7 +392,11 @@ { "cell_type": "markdown", "id": "cb6f7c1e-fa37-4e7e-84c5-1dffcb7b9416", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "Note that if you'd like, you can set custom ranges for each of the neural net parameters." ]