Menu
CoddyTech

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:

300 penguins as dots, bill length across and flipper length up: Adelie low on the left, Chinstrap low on the right, Gentoo high on the right, and a big black star between them labelled Who is she?

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:

Flipper length against body mass for the colony: Gentoo dots sit apart, high and to the right, while Adelie and Chinstrap dots overlap in one cloud

A model learns only what the measurements show, so it will need more than these two.

challenge icon

Challenge

Medium

Your colony is in penguins.csv. The program reads two measurement columns, and the starter sets up their chart.

  1. Print the baseline to beat: the largest species share, 3 decimals, and that species.
  2. Print each column with gaps and how many: the next lesson fills them.
  3. 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: 4

Then Coddy describes your chart. For body_mass_g and bill_length_mm, it looks like this:

A scatter titled body_mass_g vs bill_length_mm with a legend: Adelie dots low and light, Chinstrap high and light, Gentoo heavy on the right

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
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Supervised Learning

Practice on your own: Online Python compiler