Skip to learning content

DATA SCIENCE PYTHON PLAYGROUND

Machine Learning · Learn / Refresh

← Classification lessons
Class distributions · ML-C-R3 · 15–20 MIN

Trees and distributions retrieval

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

Outputs you create

answer
  1. The requested result, with the values, labels and row order described by this task.
Exercise evidence · ML-C-R3-1 · all 3 rows
flag_aflag_bmeasurementcategory
011.4red
102.8green
113.1blue
Your task
  1. Use the declared feature kinds to select only the binary flags in answer.
  2. Keep row order and named columns for a Bernoulli recipe.
answer
Hints

Think: Bernoulli models binary presence. Continuous measurements need a matching likelihood; named categories need the separately supported encoded categorical route.

Tools: Trees and distributions retrieval: use the supplied flag_a, flag_b, measurement, category 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[['flag_a','flag_b']].copy()
print(answer)

Bernoulli models binary presence. Continuous measurements need a matching likelihood; named categories need the separately supported encoded categorical route.

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.