Skip to learning content

DATA SCIENCE PYTHON PLAYGROUND

Machine Learning · Learn / Refresh

← Clustering and Discovery lessons
A different question · ML-U01 · 12–18 MIN

Discovery has no prediction target

State the exploratory population and question.

  1. FollowRead and run the PythonCurrent exercise
  2. ChangeCompute and inspect the evidence
  3. TransferCompute and inspect the evidence

Understand the idea

In supervised learning we had y. Here the goal is to describe structure in X. Cluster IDs are arbitrary identifiers, not predicted real-world classes. Reference labels must not guide fitting or selection.

State the exploratory population and question.QuestionPredict quantityPredict labelDiscover groupsReduce dimensions
State the exploratory population and question.Scroll the diagram horizontally if needed.

What the syntax does

df[measurement_columns]
  • Creates X without a supervised target or hidden reference label.

Outputs you create

answer
  1. The requested result, with the values, labels and row order described by this task.
penguins · first 8 rows
islandbill_length_mmbill_depth_mmflipper_length_mmbody_mass_gsexyear
Torgersen39.118.71813750male2007
Torgersen39.517.41863800female2007
Torgersen40.3181953250female2007
Torgersen36.719.31933450female2007
Torgersen39.320.61903650male2007
Torgersen38.917.81813625female2007
Torgersen39.219.61954675male2007
Torgersen41.117.61823200female2007
Your task
  1. Store only bill length, bill depth, flipper length and body mass in answer, keeping every Penguin row and the stated column order.
answer
Hints

Think: Reference labels and context fields would change the meaning of measurement-based discovery.

Tools: Explicit measurement-column selection.

Approach: Keep only the four declared numeric measurements and inspect the resulting schema.

Explained solution
answer=df[['bill_length_mm','bill_depth_mm','flipper_length_mm','body_mass_g']]

Excluding species and context keeps grouping based on the intended measured similarities rather than known labels.

Ctrl/⌘+Enter: Run · Tab: indent · Esc then Tab: leave editor

Python loads when you run. Code and results stay in this activity only.

Run your code to inspect its output. Check uses that same run.