Retrieve without the worked example: Compute macro F1 for ERROR12.
Use the new retrieval population shown here.
Retrieve earlier concepts before combining them.
This practice: Retrieve earlier concepts before combining them. Next: Retrieval 2 · Classification evidence retrieval.
Given data · ERROR12_REVIEW
12 observations. Deterministic teaching observations; values illustrate the concept rather than a real population claim. The dataframe df is supplied afresh for each Run.
| actual | predicted |
|---|---|
| A | A |
| A | B |
| A | A |
| A | A |
| A | A |
| A | A |
| A | A |
| A | A |
| B | A |
| B | B |
| B | A |
| B | A |
Column meanings and units
Column names describe the supplied features and target. Keep the stated units and row identities when making comparisons.
Synthetic data are deliberately small and reproducible. Their patterns illustrate an idea; they are not evidence about a real population.
| Column | Stored type |
|---|---|
| actual | str |
| predicted | str |
Supporting concepts: A logistic workflow →
Remember the idea
Use the inputs and evidence to recover the method. Hints and explained solutions remain collapsed; exact phrasing is not graded.
Hint 1 — Think
Recall how macro averaging handles class imbalance.
Hint 2 — Tools
f1_score and its averaging rule.
Hint 3 — Approach
Score the new actual/predicted labels using the equal-class summary.
Explained solution
from sklearn.metrics import f1_score
answer=f1_score(df.actual,df.predicted,average='macro')
The result summarises per-class F1 equally, so a large class cannot dominate simply through its row count.
Helpful prior knowledge: A logistic workflow These links are guidance, not locks.
Sources and API context
Examples run with this Playground’s scikit-learn 1.4.2 / Pyodide 0.26.4 runtime.