images for 3 lessons

pull/34/head
Jen Looper 4 years ago
parent 3479080d43
commit 61abd037fc

@ -152,6 +152,9 @@ plt.scatter(X_test, y_test, color='black')
plt.plot(X_test, y_pred, color='blue', linewidth=3)
plt.show()
```
![a scatterplot showing datapoints around diabetes](./images/scatterplot.png)
✅ Think a bit about what's going on here. A straight line is running through many small dots of data, but what is it doing exactly? Can you see how you should be able to use this line to predict where a new, unseen data point should fit in relationship to the plot's y axis? Try to put into words the practical use of this model.
Congratulations, you just built your first Linear Regression model, created a prediction with it, and displayed it in a plot!

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

File diff suppressed because one or more lines are too long

@ -16,7 +16,7 @@ The question you need answered will determine what type of ML algorithms you wil
> infographic here
What if you are trying to correlate two points of data - like age to height? You can use a regression model, as shown in the previous lesson, to draw the classical straight line through the scatterplot of points to show how, with age, height tends to increase. Thus you can predict, for a given group of people, their height given their age.
What if you are trying to correlate two points of data - like age to height? You can use a linear regression model, as shown in the previous lesson, to draw the classical straight line through the scatterplot of points to show how, with age, height tends to increase. Thus you can predict, for a given group of people, their height given their age.
> infographic here
@ -124,6 +124,8 @@ month = new_pumpkins.Month
plt.scatter(price, month)
plt.show()
```
![A scatterplot showing price to month relationship](./images/scatterplot.png)
Is this a useful plot? Does anything about it surprise you?
It's not particularly useful as all it does is display in your data as a spread of points in a given month. To get charts to display useful data, you usually need to group the data somehow. Let's try creating a plot where the y axis shows the months and the data demonstrates the distribution of data.
@ -135,6 +137,8 @@ new_pumpkins.groupby(['Month'])['Price'].mean().plot(kind='bar')
plt.ylabel("Pumpkin Price")
```
![A bar chart showing price to month relationship](./images/barchart.png)
This is a more useful data visualization! It seems to indicate that the highest price for pumpkins occurs in September and October. Does that meet your expectation? Why or why not?
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

@ -22,6 +22,13 @@
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"source": [
"## Linear Regression for Pumpkins - Lesson 2"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 22,

@ -133,6 +133,8 @@ plt.ylabel('Price')
plt.show()
```
![A scatterplot showing package to price relationship](./images/linear.png)
And you can test the model against a hypothetical variety:
```python
@ -173,6 +175,8 @@ corr = poly_pumpkins.corr()
corr.style.background_gradient(cmap='coolwarm')
```
![A heatmap showing data correlation](./images/heatmap.png)
Looking at this chart, you can visualize the good correlation between Package and Price. So you should be able to create a somewhat better model than the last one.
Build out the X and y columns:
@ -210,6 +214,9 @@ plt.ylabel('Price')
plt.scatter(X,y, color="black")
plt.show()
```
![A polynomial plot showing package to price relationship](./images/polynomial.png)
You can see a curved line that fits your data better. Let's check the model's accuracy:
```python

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

File diff suppressed because one or more lines are too long

@ -1,4 +1,7 @@
# Introduction to Machine Learning
# Logistic Regression to Predict Categories
- orange or white by price
-
Add a sketchnote if possible/appropriate
@ -42,7 +45,10 @@ code blocks
## [Topic 3]
🚀 Challenge: Add a challenge for students to work on collaboratively in class to enhance the project
---
## 🚀Challenge
Add a challenge for students to work on collaboratively in class to enhance the project
Optional: add a screenshot of the completed lesson's UI if appropriate

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save