Meet the Penguins
Part of the Supervised Learning section of Coddy's Machine Learning journey. Lesson 50 of 58.
In section 1 you explored 100 penguins. This colony has 300, and now you build the model that names them. Yours will name her:
Every project starts by looking. How many of each species? That sets the score to beat. Where are the gaps? What tells the species apart?
A scatter answers the last one. Flipper and mass find Gentoo, not the others:
A model learns only what the measurements show, so it will need more than these two.
Challenge
MediumYour colony is in penguins.csv. The program reads two measurement columns, and the starter sets up their chart.
- Print the baseline to beat: the largest species share, 3 decimals, and that species.
- Print each column with gaps and how many: the next lesson fills them.
- Scatter the two columns, one group per species labelled with its name. Add a legend and show.
For a smaller colony:
Baseline to beat: 0.483 (always Adelie)
Gaps to fill:
body_mass_g: 1
sex: 4Then Coddy describes your chart. For body_mass_g and bill_length_mm, it looks like this:
Try it yourself
import pandas as pd
import matplotlib.pyplot as plt
penguins = pd.read_csv("penguins.csv")
x_col = input()
y_col = input()
# Don't change the lines below
fig, ax = plt.subplots()
ax.set_title(f"{x_col} vs {y_col}")
ax.set_xlabel(x_col)
ax.set_ylabel(y_col)
# Write your code below
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Supervised Learning
1Your First Model
Learning from ExamplesTrain and Test SetsFit and PredictScoring a ModelRecap: Seed Sorter2Nearest Neighbors
How k-NN DecidesChoosing kDecision BoundariesScaling for NeighborsRecap: Wine Neighbors5Measuring Classifiers
The Confusion MatrixPrecision and RecallThe F1 ScoreImbalanced ClassesROC CurvesRecap: Screening Test11Project: Penguin Species
Meet the PenguinsPrepare the DataChoose a ModelTune the WinnerShip the ModelPractice on your own: Online Python compiler