Skip to learning content

DATA SCIENCE PYTHON PLAYGROUND

Machine Learning · Learn / Refresh

← Choose and Explain Models lessons
Communicate evidence · ML-M-K1 · 25–35 MIN

Choose and Explain Models checkpoint

  1. ReadinessCompute and inspect the evidenceCurrent exercise

Supplied for this practice

These objects are prepared afresh before your editor runs.

group_sizes
Supplied group_sizes; its definition below specifies the values and role.
group_sizes = pd.Series([300, 150, 50], index=['group 0', 'group 1', 'group 2'])

Outputs you create

rmse_difference
  1. Requested result described in the task and deliverables.
minority_missed
  1. Requested result described in the task and deliverables.
group_proportions
  1. Requested result described in the task and deliverables.
unsampled
  1. Requested result described in the task and deliverables.
omitted_from_display
  1. Requested result described in the task and deliverables.
Exercise evidence · ML-M-K1-1 · all 2 rows
wine_rmseminority_actualminority_caughtprofile_rowspopulation_rowsretained_varianceshown_variance
0.81025005690.90.65
0.811025005690.90.65
Your task
  1. Check the five cases below.
  2. Write a short report for each case.
  3. Wine: candidate A has CV RMSE 0.8.
  4. Candidate B has CV RMSE 0.81.
  5. Fold variation is 0.1.
  6. Penguins: classifier accuracy is .95.
  7. Recall for the minority class is .2.
  8. K-Means: k=3 has silhouette .51. k=4 has silhouette .52.
  9. Their group sizes are very different.
  10. Ward: the profiles use a 500-row sample.
  11. The report claims they describe all 569 rows.
  12. PCA: seven axes keep 90% of the variance.
  13. The picture shows only two axes.
  14. For each case, name the task.
  15. Explain what the evidence supports.
  16. State one limitation.
rmse_differenceminority_missedgroup_proportionsunsampledomitted_from_display
Hints

Think: The wine score gap is small relative to the stated fold variation of .1. Minority errors, group sizes, sample scope and display retention answer different questions; they cannot form one accuracy leaderboard.

Tools: Choose and Explain Models checkpoint: use the supplied wine_rmse, minority_actual, minority_caught, profile_rows, population_rows, retained_variance, shown_variance columns and the pandas or model operations introduced in this lesson.

Approach: Compute rmse_difference, minority_missed, group_proportions, unsampled, omitted_from_display from the supplied evidence. Preserve the requested labels and row order, then inspect the values before checking.

Explained solution
rmse_difference = df['wine_rmse'].iloc[1]-df['wine_rmse'].iloc[0]
minority_missed = df['minority_actual'].iloc[0]-df['minority_caught'].iloc[0]
group_proportions = group_sizes/group_sizes.sum()
unsampled = df['population_rows'].iloc[0]-df['profile_rows'].iloc[0]
omitted_from_display = df['retained_variance'].iloc[0]-df['shown_variance'].iloc[0]
print(rmse_difference)
print(minority_missed)
print(group_proportions)
print(unsampled)
print(omitted_from_display)

The wine score gap is small relative to the stated fold variation of .1. Minority errors, group sizes, sample scope and display retention answer different questions; they cannot form one accuracy leaderboard.

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.