Skip to learning content

DATA SCIENCE PYTHON PLAYGROUND

Machine Learning · Learn / Refresh

← Clustering and Discovery lessons
K-Means · ML-U-R1 · 15–20 MIN

K-Means retrieval

  1. Retrieval 1Compute and inspect the evidenceCurrent exercise
  2. Retrieval 2Compute and inspect the evidence
  3. Retrieval 3Retrieve the method

Outputs you create

answer
  1. The requested result, with the values, labels and row order described by this task.
Exercise evidence · ML-U-R1-1 · all 4 rows
lengthwidthspecies
12A
21B
44A
53B
Your task
  1. Select measurements only into answer.
  2. Leave species out of both fitting and choice of group count; an external comparison comes after the grouping is fixed.
answer
Hints

Think: Fitting omitted species, but selection of k still used that reference label. Select a grouping from measurement geometry, profiles and exploratory purpose before inspecting species. A later descriptive comparison with species can inform interpretation without becoming the fitting or selection objective.

Tools: K-Means retrieval: use the supplied length, width, species columns and the pandas or model operations introduced in this lesson.

Approach: Compute answer from the supplied evidence. Preserve the requested labels and row order, then inspect the values before checking.

Explained solution
answer = df[['length','width']].copy()
print(answer)

Fitting omitted species, but selection of k still used that reference label. Select a grouping from measurement geometry, profiles and exploratory purpose before inspecting species. A later descriptive comparison with species can inform interpretation without becoming the fitting or selection objective.

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.