just a few typos

pull/42/head
Jen Looper 3 years ago
parent 563c95280f
commit 29e96668c5

@ -42,8 +42,8 @@ Logistic regression does not offer the same features as linear regression. The f
There are other types of logistic regression, including multinomial and ordinal:
- **Multinomial**, involves having more than one category - "Orange, White, and Striped".
- **Ordinal**, involves ordered categories, useful if we wanted to order our outcomes logically, like our pumpkins that are ordered by a finite number of sizes (mini,sm,med,lg,xl,xxl).
- **Multinomial**, which involves having more than one category - "Orange, White, and Striped".
- **Ordinal**, which involves ordered categories, useful if we wanted to order our outcomes logically, like our pumpkins that are ordered by a finite number of sizes (mini,sm,med,lg,xl,xxl).
![Multinomial vs ordinal regression](./images/multinomial-ordinal.png)
> Infographic by [Dasani Madipalli](https://twitter.com/dasani_decoded)
@ -90,7 +90,7 @@ First, clean the data a bit, dropping null values and selecting only some of the
By now you have loaded up the [starter notebook](./notebook.ipynb) with pumpkin data once again and cleaned it so as to preserve a dataset containing a few variables, including `Color`. Let's visualize the dataframe in the notebook using a different library: [Seaborn](https://seaborn.pydata.org/index.html), which is built on Matplotlib which we used earlier.
Seaborn offers some neat ways to visualize your data. For example, you can compare distributions of the data for each point in a side-by side grid.
Seaborn offers some neat ways to visualize your data. For example, you can compare distributions of the data for each point in a side-by-side grid.
1. Create such a grid by instantiating a `PairGrid`, using our pumpkin data `new_pumpkins`, followed by calling `map()`:

@ -2,6 +2,11 @@
In this lesson, you will train an ML model on a data set that's out of this world: _UFO sightings over the past century_, sourced from [NUFORC's database](https://www.nuforc.org).
You will learn:
- How to 'pickle' a trained model
- How to use that model in a Flask app
We will continue our use of notebooks to clean data and train our model, but you can take the process one step further by exploring using a model 'in the wild', so to speak: in a web app.
To do this, you need to build a web app using Flask.
@ -17,7 +22,7 @@ There are several ways to build web apps to consume machine learning models. You
There are many questions you need to ask:
- **Is it a web app or a mobile app?** If you are building a mobile app or need to use the model in an IoT context, you could use [TensorFlow Lite](https://www.tensorflow.org/lite/) and use the model in an Android or iOS app.
- **Where will the model reside**, in the cloud or locally?
- **Where will the model reside**? In the cloud or locally?
- **Offline support**. Does the app have to work offline?
- **What technology was used to train the model?** The chosen technology may influence the tooling you need to use.
- **Using Tensor flow**. If you are training a model using TensorFlow, for example, that ecosystem provides the ability to convert a TensorFlow model for use in a web app by using [TensorFlow.js](https://www.tensorflow.org/js/).
@ -131,7 +136,7 @@ Now you can get ready to train a model by diving the data into the training and
The accuracy isn't bad **(around 95%)**, unsurprisingly, as `Country` and `Latitude/Longitude` correlate.
The model you created isn't very revolutionary as it's you should be able to infer a `Country` from its `Latitude` and `Longitude`, but it's a good exercise to try to train from raw data that you cleaned, exported, and then use this model in a web app.
The model you created isn't very revolutionary as you should be able to infer a `Country` from its `Latitude` and `Longitude`, but it's a good exercise to try to train from raw data that you cleaned, exported, and then use this model in a web app.
## Exercise - 'pickle' your model

File diff suppressed because one or more lines are too long

@ -44,24 +44,12 @@
"output_type": "stream",
"name": "stdout",
"text": [
"Collecting gym\n",
" Downloading gym-0.18.3.tar.gz (1.6 MB)\n",
"\u001b[K |████████████████████████████████| 1.6 MB 2.3 MB/s \n",
"\u001b[?25hRequirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from gym) (1.4.1)\n",
"Requirement already satisfied: gym in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.18.3)\n",
"Requirement already satisfied: Pillow<=8.2.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from gym) (7.0.0)\n",
"Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from gym) (1.4.1)\n",
"Requirement already satisfied: numpy>=1.10.4 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from gym) (1.19.2)\n",
"Collecting pyglet<=1.5.15,>=1.4.0\n",
" Downloading pyglet-1.5.15-py3-none-any.whl (1.1 MB)\n",
"\u001b[K |████████████████████████████████| 1.1 MB 3.7 MB/s \n",
"\u001b[?25hRequirement already satisfied: Pillow<=8.2.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from gym) (7.0.0)\n",
"Collecting cloudpickle<1.7.0,>=1.2.0\n",
" Downloading cloudpickle-1.6.0-py3-none-any.whl (23 kB)\n",
"Building wheels for collected packages: gym\n",
" Building wheel for gym (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for gym: filename=gym-0.18.3-py3-none-any.whl size=1657514 sha256=578c789ab75e603e58dd1152b2bd60d9a5adc6a057559cf8b5bdd6ee8b80abf2\n",
" Stored in directory: /Users/jenlooper/Library/Caches/pip/wheels/1a/ec/6d/705d53925f481ab70fd48ec7728558745eeae14dfda3b49c99\n",
"Successfully built gym\n",
"Installing collected packages: pyglet, cloudpickle, gym\n",
"Successfully installed cloudpickle-1.6.0 gym-0.18.3 pyglet-1.5.15\n",
"Requirement already satisfied: cloudpickle<1.7.0,>=1.2.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from gym) (1.6.0)\n",
"Requirement already satisfied: pyglet<=1.5.15,>=1.4.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from gym) (1.5.15)\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"
]
@ -99,7 +87,7 @@
"output_type": "stream",
"name": "stdout",
"text": [
"Discrete(2)\nBox(-3.4028234663852886e+38, 3.4028234663852886e+38, (4,), float32)\n1\n"
"Discrete(2)\nBox(-3.4028234663852886e+38, 3.4028234663852886e+38, (4,), float32)\n0\n"
]
}
]
@ -159,32 +147,25 @@
"output_type": "stream",
"name": "stdout",
"text": [
"[-0.035025 0.21201857 -0.010404 -0.3300738 ] -> 1.0\n",
"[-0.03078463 0.40728707 -0.01700547 -0.62601941] -> 1.0\n",
"[-0.02263889 0.21240657 -0.02952586 -0.3387403 ] -> 1.0\n",
"[-0.01839076 0.01771693 -0.03630067 -0.05551247] -> 1.0\n",
"[-0.01803642 0.21334007 -0.03741092 -0.35942391] -> 1.0\n",
"[-0.01376962 0.40897331 -0.0445994 -0.66366469] -> 1.0\n",
"[-0.00559015 0.21449925 -0.05787269 -0.38535156] -> 1.0\n",
"[-0.00130017 0.410393 -0.06557972 -0.69570532] -> 1.0\n",
"[ 0.00690769 0.21623893 -0.07949383 -0.42436686] -> 1.0\n",
"[ 0.01123247 0.02232776 -0.08798116 -0.15776523] -> 1.0\n",
"[ 0.01167903 0.21859198 -0.09113647 -0.47685598] -> 1.0\n",
"[ 0.01605087 0.02486705 -0.10067359 -0.21423159] -> 1.0\n",
"[ 0.01654821 0.22127341 -0.10495822 -0.53689749] -> 1.0\n",
"[ 0.02097368 0.02777162 -0.11569617 -0.27904318] -> 1.0\n",
"[ 0.02152911 -0.16552613 -0.12127703 -0.02497378] -> 1.0\n",
"[ 0.01821859 -0.35871897 -0.12177651 0.22711886] -> 1.0\n",
"[ 0.01104421 -0.16208621 -0.11723413 -0.10135989] -> 1.0\n",
"[ 0.00780248 -0.35534992 -0.11926133 0.15215788] -> 1.0\n",
"[ 0.00069548 -0.15874009 -0.11621817 -0.17564179] -> 1.0\n",
"[-0.00247932 0.03783674 -0.11973101 -0.50260923] -> 1.0\n",
"[-0.00172258 0.23442478 -0.12978319 -0.83049704] -> 1.0\n",
"[ 0.00296591 0.04129289 -0.14639313 -0.58128481] -> 1.0\n",
"[ 0.00379177 0.23812991 -0.15801883 -0.9162682 ] -> 1.0\n",
"[ 0.00855437 0.04545686 -0.17634419 -0.67712384] -> 1.0\n",
"[ 0.00946351 0.24253346 -0.18988667 -1.01973114] -> 1.0\n",
"[ 0.01431417 0.05037919 -0.21028129 -0.7921723 ] -> 1.0\n"
"[ 0.03044442 -0.19543914 -0.04496216 0.28125618] -> 1.0\n",
"[ 0.02653564 -0.38989186 -0.03933704 0.55942606] -> 1.0\n",
"[ 0.0187378 -0.19424049 -0.02814852 0.25461393] -> 1.0\n",
"[ 0.01485299 -0.38894946 -0.02305624 0.53828712] -> 1.0\n",
"[ 0.007074 -0.19351108 -0.0122905 0.23842953] -> 1.0\n",
"[ 0.00320378 0.00178427 -0.00752191 -0.05810469] -> 1.0\n",
"[ 0.00323946 0.19701326 -0.008684 -0.35315131] -> 1.0\n",
"[ 0.00717973 0.00201587 -0.01574703 -0.06321931] -> 1.0\n",
"[ 0.00722005 0.19736001 -0.01701141 -0.36082863] -> 1.0\n",
"[ 0.01116725 0.39271958 -0.02422798 -0.65882671] -> 1.0\n",
"[ 0.01902164 0.19794307 -0.03740452 -0.37387001] -> 1.0\n",
"[ 0.0229805 0.39357584 -0.04488192 -0.67810827] -> 1.0\n",
"[ 0.03085202 0.58929164 -0.05844408 -0.98457719] -> 1.0\n",
"[ 0.04263785 0.78514572 -0.07813563 -1.2950295 ] -> 1.0\n",
"[ 0.05834076 0.98116859 -0.10403622 -1.61111521] -> 1.0\n",
"[ 0.07796413 0.78741784 -0.13625852 -1.35259196] -> 1.0\n",
"[ 0.09371249 0.98396202 -0.16331036 -1.68461179] -> 1.0\n",
"[ 0.11339173 0.79106371 -0.1970026 -1.44691436] -> 1.0\n",
"[ 0.12921301 0.59883361 -0.22594088 -1.22169133] -> 1.0\n"
]
}
]
@ -281,7 +262,7 @@
"output_type": "stream",
"name": "stdout",
"text": [
"(0, 0, -1, -3)\n(0, 0, -2, 0)\n(0, 0, -2, -3)\n(0, 1, -3, -6)\n(0, 0, -4, -3)\n(0, 1, -5, -6)\n(0, 2, -6, -9)\n(0, 1, -8, -6)\n(0, 2, -9, -9)\n(0, 2, -11, -13)\n(0, 2, -14, -10)\n(0, 1, -16, -8)\n(0, 2, -18, -11)\n(0, 3, -20, -15)\n(0, 2, -23, -12)\n"
"(0, 0, -1, -3)\n(0, 0, -2, 0)\n(0, 0, -2, -3)\n(0, 1, -3, -6)\n(0, 2, -4, -9)\n(0, 3, -6, -12)\n(0, 2, -8, -9)\n(0, 3, -10, -13)\n(0, 4, -13, -16)\n(0, 4, -16, -19)\n(0, 4, -20, -17)\n(0, 4, -24, -20)\n"
]
}
],

Loading…
Cancel
Save