Created
September 1, 2020 11:03
-
-
Save abhinavm24/4cb1b56c5bbd951017fe3d8c08bc6c86 to your computer and use it in GitHub Desktop.
Baysian Optimization in FastAI.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Baysian Optimization in FastAI.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"accelerator": "GPU" | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/abhinavm24/4cb1b56c5bbd951017fe3d8c08bc6c86/baysian-optimization-in-fastai.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "JfT6ajc1288E", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"# Notebook" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "cpLkEr6H2-_Z", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"This notebook shows a working implementation of using a BaysianOptimization library within Fast.AI. Essentially we modify fit_with to have whatever hyperparameters we want to use, and their respective ranges. " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "dlmeOZMF3bBC", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 238 | |
}, | |
"outputId": "e3d76f03-132a-4171-f173-ee492e1bf3f1" | |
}, | |
"source": [ | |
"!pip install bayesian-optimization" | |
], | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Collecting bayesian-optimization\n", | |
" Downloading https://files.pythonhosted.org/packages/bb/7a/fd8059a3881d3ab37ac8f72f56b73937a14e8bb14a9733e68cc8b17dbe3c/bayesian-optimization-1.2.0.tar.gz\n", | |
"Requirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python3.6/dist-packages (from bayesian-optimization) (1.18.5)\n", | |
"Requirement already satisfied: scipy>=0.14.0 in /usr/local/lib/python3.6/dist-packages (from bayesian-optimization) (1.4.1)\n", | |
"Requirement already satisfied: scikit-learn>=0.18.0 in /usr/local/lib/python3.6/dist-packages (from bayesian-optimization) (0.22.2.post1)\n", | |
"Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn>=0.18.0->bayesian-optimization) (0.16.0)\n", | |
"Building wheels for collected packages: bayesian-optimization\n", | |
" Building wheel for bayesian-optimization (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
" Created wheel for bayesian-optimization: filename=bayesian_optimization-1.2.0-cp36-none-any.whl size=11685 sha256=7e6175205e637587f182ad7b986a230a059e127a8013bf5212b10b2dbafba65b\n", | |
" Stored in directory: /root/.cache/pip/wheels/5a/56/ae/e0e3c1fc1954dc3ec712e2df547235ed072b448094d8f94aec\n", | |
"Successfully built bayesian-optimization\n", | |
"Installing collected packages: bayesian-optimization\n", | |
"Successfully installed bayesian-optimization-1.2.0\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "4D4zEkKK25c3", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"from fastai import *\n", | |
"from fastai.tabular import *\n", | |
"from bayes_opt import BayesianOptimization\n", | |
"from fastprogress import *" | |
], | |
"execution_count": 3, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "CBQOksSd3pmb", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"Here the example will be the Adults dataset, where we will adjust the weight decay, learning rate, and dropout" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "4ygX7iWV6VV3", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 34 | |
}, | |
"outputId": "83d67f4e-b276-455b-db05-f97126fdb8bb" | |
}, | |
"source": [ | |
"path = untar_data(URLs.ADULT_SAMPLE)\n", | |
"df = pd.read_csv(path/'adult.csv')" | |
], | |
"execution_count": 5, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Downloading http://files.fast.ai/data/examples/adult_sample.tgz\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "_o2Mw8pg6WsT", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"dep_var = 'salary'\n", | |
"cat_names = ['workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race']\n", | |
"cont_names = ['age', 'fnlwgt', 'education-num']\n", | |
"procs = [FillMissing, Categorify, Normalize]" | |
], | |
"execution_count": 6, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "8xTFXIU26X-6", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"data = (TabularList.from_df(df, path=path, cat_names=cat_names, cont_names=cont_names, procs=procs)\n", | |
" .split_by_idx(list(range(800,1000)))\n", | |
" .label_from_df(cols=dep_var)\n", | |
" .databunch())" | |
], | |
"execution_count": 8, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "XPi65G3Q6bM1", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"Anything you want adjusted goes into `fit_with`" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "iNAWeoqz3oAj", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"\n", | |
"from fastai.utils.mod_display import *\n", | |
"\n", | |
"def fit_with(lr, wd, dp):\n", | |
" \n", | |
" # Create our learner with the parameters\n", | |
" learn = tabular_learner(data, layers=[200,100], metrics=accuracy, emb_drop=dp, wd=wd)\n", | |
" \n", | |
" # train the model at the specified learning rate\n", | |
" with progress_disabled_ctx(learn) as learn:\n", | |
" learn.fit_one_cycle(3, max_lr=lr)\n", | |
" \n", | |
" # save, print, and return the model's overall accuracy\n", | |
" acc = float(learn.validate(learn.data.valid_dl)[1])\n", | |
" \n", | |
" # Small change to the standard, we are only returning accuracy\n", | |
" \n", | |
" return acc" | |
], | |
"execution_count": 14, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "JWhCOMdx4cAd", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"Lastly we need to dictate the upper and lower bounds we want to examine" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "UicFp63y4boy", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"pbounds = {'lr': (1e-5, 1e-2), 'wd': (4e-4, 0.4), 'dp': (0.01, 0.5)}" | |
], | |
"execution_count": 10, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "9vhxOsLz4r3K", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"Now we make the optimizer" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "tAnPHSDM4p09", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"optimizer = BayesianOptimization( \n", | |
" f = fit_with, # use our custom fit function \n", | |
" pbounds=pbounds, # use our limits\n", | |
" verbose = 2, # 1 prints a maximum only when it is observed, 0 is completely silent\n", | |
" random_state=1)" | |
], | |
"execution_count": 15, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "GLKrybGI5Ivn", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"Now we run it! It can take a while depending. Then we can print the best one!" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "VghGmuyi4-ja", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 578 | |
}, | |
"outputId": "a29e1496-8ef2-4d72-f237-1fcd5a273974" | |
}, | |
"source": [ | |
"optimizer.maximize()" | |
], | |
"execution_count": 16, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| iter | target | dp | lr | wd |\n", | |
"-------------------------------------------------------------\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 1 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.2143 \u001b[0m | \u001b[0m 0.007206\u001b[0m | \u001b[0m 0.000445\u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 2 \u001b[0m | \u001b[95m 0.83 \u001b[0m | \u001b[95m 0.1581 \u001b[0m | \u001b[95m 0.001476\u001b[0m | \u001b[95m 0.0373 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 3 \u001b[0m | \u001b[95m 0.84 \u001b[0m | \u001b[95m 0.1013 \u001b[0m | \u001b[95m 0.003462\u001b[0m | \u001b[95m 0.1589 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 4 \u001b[0m | \u001b[0m 0.825 \u001b[0m | \u001b[0m 0.274 \u001b[0m | \u001b[0m 0.004198\u001b[0m | \u001b[0m 0.2742 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 5 \u001b[0m | \u001b[0m 0.83 \u001b[0m | \u001b[0m 0.1102 \u001b[0m | \u001b[0m 0.008782\u001b[0m | \u001b[0m 0.01134 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 6 \u001b[0m | \u001b[0m 0.83 \u001b[0m | \u001b[0m 0.01255 \u001b[0m | \u001b[0m 0.005202\u001b[0m | \u001b[0m 0.3986 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 7 \u001b[0m | \u001b[0m 0.765 \u001b[0m | \u001b[0m 0.01089 \u001b[0m | \u001b[0m 5.983e-0\u001b[0m | \u001b[0m 0.1282 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 8 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.5 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.4 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 9 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.2072 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.4 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 10 \u001b[0m | \u001b[0m 0.815 \u001b[0m | \u001b[0m 0.5 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.0004 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 11 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.5 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.1947 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 12 \u001b[0m | \u001b[0m 0.825 \u001b[0m | \u001b[0m 0.1168 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.2979 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 13 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.2189 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.1414 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 14 \u001b[0m | \u001b[0m 0.69 \u001b[0m | \u001b[0m 0.381 \u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.4 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 15 \u001b[0m | \u001b[0m 0.66 \u001b[0m | \u001b[0m 0.1072 \u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.4 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 16 \u001b[0m | \u001b[0m 0.825 \u001b[0m | \u001b[0m 0.3418 \u001b[0m | \u001b[0m 0.005484\u001b[0m | \u001b[0m 0.1535 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 17 \u001b[0m | \u001b[0m 0.825 \u001b[0m | \u001b[0m 0.07897 \u001b[0m | \u001b[0m 0.001402\u001b[0m | \u001b[0m 0.127 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 18 \u001b[0m | \u001b[0m 0.835 \u001b[0m | \u001b[0m 0.1443 \u001b[0m | \u001b[0m 0.007646\u001b[0m | \u001b[0m 0.02712 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 19 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.2845 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 20 \u001b[0m | \u001b[0m 0.815 \u001b[0m | \u001b[0m 0.09686 \u001b[0m | \u001b[0m 0.001348\u001b[0m | \u001b[0m 0.1623 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 21 \u001b[0m | \u001b[0m 0.835 \u001b[0m | \u001b[0m 0.1442 \u001b[0m | \u001b[0m 0.006002\u001b[0m | \u001b[0m 0.02648 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 22 \u001b[0m | \u001b[0m 0.69 \u001b[0m | \u001b[0m 0.3806 \u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.0004 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 23 \u001b[0m | \u001b[0m 0.83 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.0004 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 24 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.4224 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.2746 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 25 \u001b[0m | \u001b[0m 0.635 \u001b[0m | \u001b[0m 0.5 \u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.08711 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 26 \u001b[0m | \u001b[0m 0.815 \u001b[0m | \u001b[0m 0.4999 \u001b[0m | \u001b[0m 0.003529\u001b[0m | \u001b[0m 0.3079 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 27 \u001b[0m | \u001b[0m 0.82 \u001b[0m | \u001b[0m 0.1227 \u001b[0m | \u001b[0m 0.000657\u001b[0m | \u001b[0m 0.2817 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 28 \u001b[0m | \u001b[0m 0.815 \u001b[0m | \u001b[0m 0.1845 \u001b[0m | \u001b[0m 0.01 \u001b[0m | \u001b[0m 0.2388 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 29 \u001b[0m | \u001b[0m 0.825 \u001b[0m | \u001b[0m 0.2691 \u001b[0m | \u001b[0m 0.009713\u001b[0m | \u001b[0m 0.362 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 30 \u001b[0m | \u001b[0m 0.805 \u001b[0m | \u001b[0m 0.4212 \u001b[0m | \u001b[0m 0.004191\u001b[0m | \u001b[0m 0.1187 \u001b[0m |\n", | |
"=============================================================\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "CQbtxpiI5OG_", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 34 | |
}, | |
"outputId": "f971c39b-2f0f-4cce-a679-f9075f0c8dc1" | |
}, | |
"source": [ | |
"print(optimizer.max)" | |
], | |
"execution_count": 17, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"{'target': 0.8399999737739563, 'params': {'dp': 0.10126750357505873, 'lr': 0.0034621516631600474, 'wd': 0.15894828270257572}}\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "fkLwTqlqkjN3", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "NxaKsf5JqsMD", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "zf1Fct-IwWTy", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"# Vision" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "M-xcPDWWw-tW", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"def set_seed(s):\n", | |
" \"Set random seed for `random`, `torch`, and `numpy` (where available)\"\n", | |
" try: torch.manual_seed(s)\n", | |
" except NameError: pass\n", | |
" try: np.random.seed(s%(2**32-1))\n", | |
" except NameError: pass\n", | |
" random.seed(s)" | |
], | |
"execution_count": 86, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "5vkmpbd5qsRA", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 34 | |
}, | |
"outputId": "a68fe0b8-47eb-41b1-9a48-4c8f9b7d77e1" | |
}, | |
"source": [ | |
"from fastai.vision import *\n", | |
"\n", | |
"path = untar_data(URLs.CIFAR_100)\n", | |
"path" | |
], | |
"execution_count": 87, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"PosixPath('/root/.fastai/data/cifar100')" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 87 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "JASLD8-mqzM0", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 111 | |
}, | |
"outputId": "9e38c931-019c-4135-94f2-b5736dab659f" | |
}, | |
"source": [ | |
"#Raw FastAI\n", | |
"\n", | |
"tfms = [rotate(degrees=(-20, 20))]\n", | |
"\n", | |
"data = ImageDataBunch.from_folder(path, ds_tfms=(tfms, []), valid_pct=0.3, bs=4096)\n", | |
" \n", | |
"# Create our learner with the parameters\n", | |
"learn = cnn_learner(data, models.resnet18, metrics=accuracy)\n", | |
"\n", | |
"learn.fit_one_cycle(2, max_lr=0.003)\n", | |
"\n", | |
"# epoch\ttrain_loss\tvalid_loss\taccuracy\ttime\n", | |
"# 0\t4.618942\t3.489362\t0.213500\t00:46" | |
], | |
"execution_count": 91, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: left;\">\n", | |
" <th>epoch</th>\n", | |
" <th>train_loss</th>\n", | |
" <th>valid_loss</th>\n", | |
" <th>accuracy</th>\n", | |
" <th>time</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>5.573173</td>\n", | |
" <td>4.153380</td>\n", | |
" <td>0.086278</td>\n", | |
" <td>00:45</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>4.813323</td>\n", | |
" <td>3.799409</td>\n", | |
" <td>0.156778</td>\n", | |
" <td>00:45</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "UEeKneNmrhL2", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 595 | |
}, | |
"outputId": "8bc50c38-bf0c-4159-9bea-96293bca06fe" | |
}, | |
"source": [ | |
"from fastai.utils.mod_display import *\n", | |
"\n", | |
"def fit_with(bs, lr, rotation):\n", | |
"\n", | |
" set_seed(42)\n", | |
" \n", | |
" tfms = [rotate(degrees=(-rotation, rotation))]\n", | |
"\n", | |
" data = ImageDataBunch.from_folder(path, ds_tfms=(tfms, []), valid_pct=0.3, bs=int(bs))\n", | |
" \n", | |
" # Create our learner with the parameters\n", | |
" learn = cnn_learner(data, models.resnet18, metrics=accuracy)\n", | |
"\n", | |
" # train the model at the specified learning rate\n", | |
" with progress_disabled_ctx(learn) as learn:\n", | |
" learn.fit_one_cycle(2, max_lr=lr)\n", | |
"\n", | |
" # save, print, and return the model's overall accuracy\n", | |
" acc = float(learn.validate(learn.data.valid_dl)[1])\n", | |
"\n", | |
" # Small change to the standard, we are only returning accuracy\n", | |
" \n", | |
" return acc\n", | |
"\n", | |
"pbounds = {'bs':(32, 4096) , 'lr': (1e-5, 1e-1), 'rotation': (0, 45)}\n", | |
"\n", | |
"optimizer = BayesianOptimization(\n", | |
" f = fit_with, # use our custom fit function \n", | |
" pbounds=pbounds, # use our limits\n", | |
" verbose = 2, # 1 prints a maximum only when it is observed, 0 is completely silent\n", | |
" random_state=42)\n", | |
"\n", | |
"optimizer.maximize()\n", | |
"\n", | |
"print(optimizer.max)" | |
], | |
"execution_count": 89, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| iter | target | bs | lr | rotation |\n", | |
"-------------------------------------------------------------\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 1 \u001b[0m | \u001b[0m 0.2485 \u001b[0m | \u001b[0m 1.554e+0\u001b[0m | \u001b[0m 0.09507 \u001b[0m | \u001b[0m 32.94 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 2 \u001b[0m | \u001b[95m 0.2952 \u001b[0m | \u001b[95m 2.465e+0\u001b[0m | \u001b[95m 0.01561 \u001b[0m | \u001b[95m 7.02 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 3 \u001b[0m | \u001b[95m 0.3276 \u001b[0m | \u001b[95m 268.1 \u001b[0m | \u001b[95m 0.08662 \u001b[0m | \u001b[95m 27.05 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 4 \u001b[0m | \u001b[0m 0.1633 \u001b[0m | \u001b[0m 2.91e+03\u001b[0m | \u001b[0m 0.002068\u001b[0m | \u001b[0m 43.65 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 5 \u001b[0m | \u001b[0m 0.2233 \u001b[0m | \u001b[0m 3.415e+0\u001b[0m | \u001b[0m 0.02124 \u001b[0m | \u001b[0m 8.182 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 6 \u001b[0m | \u001b[0m 0.01056 \u001b[0m | \u001b[0m 4.096e+0\u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 45.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 7 \u001b[0m | \u001b[95m 0.3447 \u001b[0m | \u001b[95m 265.5 \u001b[0m | \u001b[95m 0.00601 \u001b[0m | \u001b[95m 24.96 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 8 \u001b[0m | \u001b[0m 0.01122 \u001b[0m | \u001b[0m 1.015e+0\u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 9 \u001b[0m | \u001b[0m 0.1485 \u001b[0m | \u001b[0m 2.013e+0\u001b[0m | \u001b[0m 0.1 \u001b[0m | \u001b[0m 45.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 10 \u001b[0m | \u001b[0m 0.1373 \u001b[0m | \u001b[0m 32.15 \u001b[0m | \u001b[0m 0.05699 \u001b[0m | \u001b[0m 44.84 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 11 \u001b[0m | \u001b[0m 0.1262 \u001b[0m | \u001b[0m 3.746e+0\u001b[0m | \u001b[0m 0.07231 \u001b[0m | \u001b[0m 1.292 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 12 \u001b[0m | \u001b[0m 0.01178 \u001b[0m | \u001b[0m 666.3 \u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 13 \u001b[0m | \u001b[0m 0.2884 \u001b[0m | \u001b[0m 1.303e+0\u001b[0m | \u001b[0m 0.03171 \u001b[0m | \u001b[0m 44.39 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 14 \u001b[0m | \u001b[0m 0.1605 \u001b[0m | \u001b[0m 3.154e+0\u001b[0m | \u001b[0m 0.09579 \u001b[0m | \u001b[0m 0.5446 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 15 \u001b[0m | \u001b[0m 0.0095 \u001b[0m | \u001b[0m 2.271e+0\u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 45.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 16 \u001b[0m | \u001b[0m 0.2634 \u001b[0m | \u001b[0m 2.672e+0\u001b[0m | \u001b[0m 0.00785 \u001b[0m | \u001b[0m 0.5926 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 17 \u001b[0m | \u001b[0m 0.01111 \u001b[0m | \u001b[0m 1.793e+0\u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 18 \u001b[0m | \u001b[95m 0.3886 \u001b[0m | \u001b[95m 141.7 \u001b[0m | \u001b[95m 0.07292 \u001b[0m | \u001b[95m 0.6104 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 19 \u001b[0m | \u001b[95m 0.4041 \u001b[0m | \u001b[95m 395.2 \u001b[0m | \u001b[95m 0.02774 \u001b[0m | \u001b[95m 0.08138 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 20 \u001b[0m | \u001b[0m 0.2957 \u001b[0m | \u001b[0m 1.405e+0\u001b[0m | \u001b[0m 0.06813 \u001b[0m | \u001b[0m 0.603 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 21 \u001b[0m | \u001b[0m 0.16 \u001b[0m | \u001b[0m 2.559e+0\u001b[0m | \u001b[0m 0.06908 \u001b[0m | \u001b[0m 44.22 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 22 \u001b[0m | \u001b[0m 0.1828 \u001b[0m | \u001b[0m 3.606e+0\u001b[0m | \u001b[0m 0.02834 \u001b[0m | \u001b[0m 44.51 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 23 \u001b[0m | \u001b[0m 0.402 \u001b[0m | \u001b[0m 275.4 \u001b[0m | \u001b[0m 0.07331 \u001b[0m | \u001b[0m 0.1507 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 24 \u001b[0m | \u001b[0m 0.01044 \u001b[0m | \u001b[0m 3.912e+0\u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 45.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 25 \u001b[0m | \u001b[0m 0.391 \u001b[0m | \u001b[0m 510.5 \u001b[0m | \u001b[0m 0.03295 \u001b[0m | \u001b[0m 0.2234 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 26 \u001b[0m | \u001b[0m 0.3473 \u001b[0m | \u001b[0m 1.201e+0\u001b[0m | \u001b[0m 0.05111 \u001b[0m | \u001b[0m 0.04967 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 27 \u001b[0m | \u001b[0m 0.1352 \u001b[0m | \u001b[0m 3.272e+0\u001b[0m | \u001b[0m 0.06742 \u001b[0m | \u001b[0m 43.98 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 28 \u001b[0m | \u001b[0m 0.009222\u001b[0m | \u001b[0m 2.117e+0\u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 0.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 29 \u001b[0m | \u001b[0m 0.2236 \u001b[0m | \u001b[0m 2.814e+0\u001b[0m | \u001b[0m 0.07948 \u001b[0m | \u001b[0m 0.9276 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 30 \u001b[0m | \u001b[0m 0.01039 \u001b[0m | \u001b[0m 1.146e+0\u001b[0m | \u001b[0m 1e-05 \u001b[0m | \u001b[0m 45.0 \u001b[0m |\n", | |
"=============================================================\n", | |
"{'target': 0.4041111171245575, 'params': {'bs': 395.2093912585002, 'lr': 0.02774298937917005, 'rotation': 0.08138157311834315}}\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "S5-gHpuFv1nz", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "kKI9qqw7rEMi", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 595 | |
}, | |
"outputId": "5cd11945-2171-4398-88ea-44ab77ca544b" | |
}, | |
"source": [ | |
"from fastai.utils.mod_display import *\n", | |
"\n", | |
"def fit_with(bs, rotation):\n", | |
"\n", | |
" set_seed(42)\n", | |
" \n", | |
" tfms = [rotate(degrees=(-rotation, rotation))]\n", | |
"\n", | |
" data = ImageDataBunch.from_folder(path, ds_tfms=(tfms, []), valid_pct=0.3, bs=int(bs))\n", | |
" \n", | |
" # Create our learner with the parameters\n", | |
" learn = cnn_learner(data, models.resnet18, metrics=accuracy)\n", | |
"\n", | |
" # train the model at the specified learning rate\n", | |
" with progress_disabled_ctx(learn) as learn:\n", | |
" learn.fit_one_cycle(2, max_lr=0.03)\n", | |
"\n", | |
" # save, print, and return the model's overall accuracy\n", | |
" acc = float(learn.validate(learn.data.valid_dl)[1])\n", | |
"\n", | |
" # Small change to the standard, we are only returning accuracy\n", | |
" \n", | |
" return acc\n", | |
"\n", | |
"pbounds = {'bs':(32, 4096) , 'rotation': (0, 45)}\n", | |
"\n", | |
"optimizer = BayesianOptimization(\n", | |
" f = fit_with, # use our custom fit function \n", | |
" pbounds=pbounds, # use our limits\n", | |
" verbose = 2, # 1 prints a maximum only when it is observed, 0 is completely silent\n", | |
" random_state=42)\n", | |
"\n", | |
"optimizer.maximize()\n", | |
"\n", | |
"print(optimizer.max)" | |
], | |
"execution_count": 90, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| iter | target | bs | rotation |\n", | |
"-------------------------------------------------\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 1 \u001b[0m | \u001b[0m 0.2955 \u001b[0m | \u001b[0m 1.554e+0\u001b[0m | \u001b[0m 42.78 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 2 \u001b[0m | \u001b[0m 0.2331 \u001b[0m | \u001b[0m 3.007e+0\u001b[0m | \u001b[0m 26.94 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 3 \u001b[0m | \u001b[95m 0.3681 \u001b[0m | \u001b[95m 666.1 \u001b[0m | \u001b[95m 7.02 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 4 \u001b[0m | \u001b[0m 0.3661 \u001b[0m | \u001b[0m 268.1 \u001b[0m | \u001b[0m 38.98 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 5 \u001b[0m | \u001b[0m 0.2523 \u001b[0m | \u001b[0m 2.475e+0\u001b[0m | \u001b[0m 31.86 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 6 \u001b[0m | \u001b[95m 0.4028 \u001b[0m | \u001b[95m 46.27 \u001b[0m | \u001b[95m 1.801 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 7 \u001b[0m | \u001b[0m 0.3918 \u001b[0m | \u001b[0m 46.69 \u001b[0m | \u001b[0m 4.938 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 8 \u001b[0m | \u001b[0m 0.2012 \u001b[0m | \u001b[0m 4.096e+0\u001b[0m | \u001b[0m 0.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 9 \u001b[0m | \u001b[0m 0.1947 \u001b[0m | \u001b[0m 3.579e+0\u001b[0m | \u001b[0m 45.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 10 \u001b[0m | \u001b[0m 0.3296 \u001b[0m | \u001b[0m 1.996e+0\u001b[0m | \u001b[0m 1.114 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 11 \u001b[0m | \u001b[95m 0.4037 \u001b[0m | \u001b[95m 372.6 \u001b[0m | \u001b[95m 0.105 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 12 \u001b[0m | \u001b[0m 0.3633 \u001b[0m | \u001b[0m 1.098e+0\u001b[0m | \u001b[0m 0.4664 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 13 \u001b[0m | \u001b[95m 0.4202 \u001b[0m | \u001b[95m 216.1 \u001b[0m | \u001b[95m 0.07337 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 14 \u001b[0m | \u001b[95m 0.4256 \u001b[0m | \u001b[95m 158.6 \u001b[0m | \u001b[95m 0.3549 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 15 \u001b[0m | \u001b[0m 0.3006 \u001b[0m | \u001b[0m 923.7 \u001b[0m | \u001b[0m 44.55 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 16 \u001b[0m | \u001b[0m 0.3557 \u001b[0m | \u001b[0m 1.349e+0\u001b[0m | \u001b[0m 0.06168 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 17 \u001b[0m | \u001b[95m 0.4312 \u001b[0m | \u001b[95m 139.5 \u001b[0m | \u001b[95m 0.4006 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 18 \u001b[0m | \u001b[0m 0.2559 \u001b[0m | \u001b[0m 3.291e+0\u001b[0m | \u001b[0m 0.6339 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 19 \u001b[0m | \u001b[0m 0.2676 \u001b[0m | \u001b[0m 2.196e+0\u001b[0m | \u001b[0m 44.88 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 20 \u001b[0m | \u001b[0m 0.3338 \u001b[0m | \u001b[0m 1.753e+0\u001b[0m | \u001b[0m 0.2096 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 21 \u001b[0m | \u001b[0m 0.3147 \u001b[0m | \u001b[0m 1.21e+03\u001b[0m | \u001b[0m 44.51 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[95m 22 \u001b[0m | \u001b[95m 0.4327 \u001b[0m | \u001b[95m 128.4 \u001b[0m | \u001b[95m 0.5275 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 23 \u001b[0m | \u001b[0m 0.2109 \u001b[0m | \u001b[0m 3.842e+0\u001b[0m | \u001b[0m 0.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 24 \u001b[0m | \u001b[0m 0.2943 \u001b[0m | \u001b[0m 2.733e+0\u001b[0m | \u001b[0m 0.0 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 25 \u001b[0m | \u001b[0m 0.3331 \u001b[0m | \u001b[0m 536.2 \u001b[0m | \u001b[0m 44.57 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 26 \u001b[0m | \u001b[0m 0.2778 \u001b[0m | \u001b[0m 1.908e+0\u001b[0m | \u001b[0m 44.61 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 27 \u001b[0m | \u001b[0m 0.4279 \u001b[0m | \u001b[0m 110.0 \u001b[0m | \u001b[0m 0.2102 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 28 \u001b[0m | \u001b[0m 0.4262 \u001b[0m | \u001b[0m 143.4 \u001b[0m | \u001b[0m 1.075 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 29 \u001b[0m | \u001b[0m 0.4253 \u001b[0m | \u001b[0m 134.1 \u001b[0m | \u001b[0m 1.023 \u001b[0m |\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "stream", | |
"text": [ | |
"| \u001b[0m 30 \u001b[0m | \u001b[0m 0.4265 \u001b[0m | \u001b[0m 142.5 \u001b[0m | \u001b[0m 0.2708 \u001b[0m |\n", | |
"=================================================\n", | |
"{'target': 0.43272221088409424, 'params': {'bs': 128.42848348192453, 'rotation': 0.5274612184599842}}\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "e8DIWVuEFtDR", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment