diff --git a/3-Web-App/README.md b/3-Web-App/README.md index bfbe5899..a8de4606 100644 --- a/3-Web-App/README.md +++ b/3-Web-App/README.md @@ -4,7 +4,7 @@ In this section of the curriculum, you will be introduced to an applied ML topic ## Lessons -1. [Build a Web App](3-Web-App/README.md) +1. [Build a Web App](1-Web-App/README.md) ## Credits diff --git a/4-Classification/4-Applied/solution/index.html b/4-Classification/4-Applied/solution/index.html new file mode 100644 index 00000000..56992014 --- /dev/null +++ b/4-Classification/4-Applied/solution/index.html @@ -0,0 +1,28 @@ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/4-Classification/4-Applied/solution/model-kn.onnx b/4-Classification/4-Applied/solution/model-kn.onnx new file mode 100644 index 00000000..4ce8e6b9 Binary files /dev/null and b/4-Classification/4-Applied/solution/model-kn.onnx differ diff --git a/4-Classification/4-Applied/solution/notebook.ipynb b/4-Classification/4-Applied/solution/notebook.ipynb index e69de29b..3eaba762 100644 --- a/4-Classification/4-Applied/solution/notebook.ipynb +++ b/4-Classification/4-Applied/solution/notebook.ipynb @@ -0,0 +1,56 @@ +{ + "metadata": { + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": 3 + }, + "orig_nbformat": 2 + }, + "nbformat": 4, + "nbformat_minor": 2, + "cells": [ + { + "source": [ + "## Build a web app" + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "pip install skl2onnx" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "pip install onnxruntime" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np \n", + "import pandas as pd " + ] + } + ] +} \ No newline at end of file diff --git a/4-Classification/4-Applied/solution/recipe-detector.ipynb b/4-Classification/4-Applied/solution/recipe-detector.ipynb new file mode 100644 index 00000000..a8bbe19a --- /dev/null +++ b/4-Classification/4-Applied/solution/recipe-detector.ipynb @@ -0,0 +1,328 @@ +{ + "metadata": { + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.0" + }, + "orig_nbformat": 2, + "kernelspec": { + "name": "python37364bit8d3b438fb5fc4430a93ac2cb74d693a7", + "display_name": "Python 3.7.0 64-bit ('3.7')" + }, + "metadata": { + "interpreter": { + "hash": "70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d" + } + } + }, + "nbformat": 4, + "nbformat_minor": 2, + "cells": [ + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting skl2onnx\n", + " Using cached skl2onnx-1.8.0-py2.py3-none-any.whl (230 kB)\n", + "Requirement already satisfied: six in /Users/jenlooper/Library/Python/3.7/lib/python/site-packages (from skl2onnx) (1.12.0)\n", + "Requirement already satisfied: scipy>=1.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from skl2onnx) (1.4.1)\n", + "Requirement already satisfied: protobuf in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from skl2onnx) (3.8.0)\n", + "Requirement already satisfied: scikit-learn>=0.19 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from skl2onnx) (0.24.2)\n", + "Requirement already satisfied: numpy>=1.15 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from skl2onnx) (1.19.2)\n", + "Collecting onnx>=1.2.1\n", + " Downloading onnx-1.9.0-cp37-cp37m-macosx_10_12_x86_64.whl (12.0 MB)\n", + "\u001b[K |████████████████████████████████| 12.0 MB 6.6 MB/s \n", + "\u001b[?25hCollecting onnxconverter-common<1.9,>=1.6.1\n", + " Downloading onnxconverter_common-1.8.1-py2.py3-none-any.whl (77 kB)\n", + "\u001b[K |████████████████████████████████| 77 kB 8.2 MB/s \n", + "\u001b[?25hRequirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from protobuf->skl2onnx) (45.1.0)\n", + "Requirement already satisfied: joblib>=0.11 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from scikit-learn>=0.19->skl2onnx) (0.16.0)\n", + "Requirement already satisfied: threadpoolctl>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from scikit-learn>=0.19->skl2onnx) (2.1.0)\n", + "Collecting typing-extensions>=3.6.2.1\n", + " Downloading typing_extensions-3.10.0.0-py3-none-any.whl (26 kB)\n", + "Installing collected packages: typing-extensions, onnx, onnxconverter-common, skl2onnx\n", + "Successfully installed onnx-1.9.0 onnxconverter-common-1.8.1 skl2onnx-1.8.0 typing-extensions-3.10.0.0\n", + "\u001b[33mWARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.\n", + "You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -m pip install --upgrade pip' command.\u001b[0m\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], + "source": [ + "pip install skl2onnx" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting onnxruntime\n", + " Downloading onnxruntime-1.8.0-cp37-cp37m-macosx_10_12_x86_64.whl (5.0 MB)\n", + "\u001b[K |████████████████████████████████| 5.0 MB 3.1 MB/s \n", + "\u001b[?25hRequirement already satisfied: numpy>=1.16.6 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from onnxruntime) (1.19.2)\n", + "Requirement already satisfied: protobuf in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from onnxruntime) (3.8.0)\n", + "Collecting flatbuffers\n", + " Downloading flatbuffers-2.0-py2.py3-none-any.whl (26 kB)\n", + "Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from protobuf->onnxruntime) (45.1.0)\n", + "Requirement already satisfied: six>=1.9 in /Users/jenlooper/Library/Python/3.7/lib/python/site-packages (from protobuf->onnxruntime) (1.12.0)\n", + "Installing collected packages: flatbuffers, onnxruntime\n", + "Successfully installed flatbuffers-2.0 onnxruntime-1.8.0\n", + "\u001b[33mWARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.\n", + "You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -m pip install --upgrade pip' command.\u001b[0m\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], + "source": [ + "pip install onnxruntime" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np \n", + "import pandas as pd \n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Unnamed: 0 cuisine almond angelica anise anise_seed apple \\\n", + "0 0 indian 0 0 0 0 0 \n", + "1 1 indian 1 0 0 0 0 \n", + "2 2 indian 0 0 0 0 0 \n", + "3 3 indian 0 0 0 0 0 \n", + "4 4 indian 0 0 0 0 0 \n", + "\n", + " apple_brandy apricot armagnac ... whiskey white_bread white_wine \\\n", + "0 0 0 0 ... 0 0 0 \n", + "1 0 0 0 ... 0 0 0 \n", + "2 0 0 0 ... 0 0 0 \n", + "3 0 0 0 ... 0 0 0 \n", + "4 0 0 0 ... 0 0 0 \n", + "\n", + " whole_grain_wheat_flour wine wood yam yeast yogurt zucchini \n", + "0 0 0 0 0 0 0 0 \n", + "1 0 0 0 0 0 0 0 \n", + "2 0 0 0 0 0 0 0 \n", + "3 0 0 0 0 0 0 0 \n", + "4 0 0 0 0 0 1 0 \n", + "\n", + "[5 rows x 382 columns]" + ], + "text/html": "\n | Unnamed: 0 | \ncuisine | \nalmond | \nangelica | \nanise | \nanise_seed | \napple | \napple_brandy | \napricot | \narmagnac | \n... | \nwhiskey | \nwhite_bread | \nwhite_wine | \nwhole_grain_wheat_flour | \nwine | \nwood | \nyam | \nyeast | \nyogurt | \nzucchini | \n
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n0 | \nindian | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
1 | \n1 | \nindian | \n1 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
2 | \n2 | \nindian | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
3 | \n3 | \nindian | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
4 | \n4 | \nindian | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n1 | \n0 | \n
5 rows × 382 columns
\n\n | almond | \nangelica | \nanise | \nanise_seed | \napple | \napple_brandy | \napricot | \narmagnac | \nartemisia | \nartichoke | \n... | \nwhiskey | \nwhite_bread | \nwhite_wine | \nwhole_grain_wheat_flour | \nwine | \nwood | \nyam | \nyeast | \nyogurt | \nzucchini | \n
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
1 | \n1 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
2 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
3 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n
4 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n... | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n0 | \n1 | \n0 | \n
5 rows × 380 columns
\n\n | cuisine | \n
---|---|
0 | \nindian | \n
1 | \nindian | \n
2 | \nindian | \n
3 | \nindian | \n
4 | \nindian | \n