Baseline First
You'll compute the score a model gets by always guessing the most common answer, and learn to never report an accuracy without it.
About
A model that's 96 percent accurate sounds great until you learn that 96 percent of the rows have the same label, so guessing that label every time does just as well. Every accuracy number in this track is meaningless without the number it has to beat, and this short badge builds the habit you'll use on every badge after it. You need one classification dataset and one regression dataset, both free, and a few lines of code. What counts is a baseline for each, a real model that beats it, and a case where the baseline wins.
At a glance
- Per requirement
- 15 XP
- Completion bonus
- 75 XP
- Requirements
- 5
- Takes
- One evening
- Skill level
- Beginner (done it a few times)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Find a classification dataset where one class dominates. Credit card fraud, loan default, a medical screening set, or any dataset where the interesting label is under 10 percent of the rows. The UCI repository and OpenML have plenty for free. Print the class counts and the fraction of the biggest class. That fraction is the accuracy of a model that always says no. Take a screenshot of the counts. Photo
-
2
Train any quick classifier and report its accuracy next to the baseline. Logistic regression or a small decision tree from a library is fine here, because the model isn't the lesson. Use a held-out fifth of the rows. If the model's accuracy is within a point of the majority baseline, say so plainly, because it means the model has learned nothing yet. Take a screenshot showing both numbers on the same line. Photo
-
3
Score the same model with precision and recall on the rare class. Accuracy hides what happens to the 5 percent you care about. Precision is how many of the rows it flagged were really positive; recall is how many of the real positives it caught. Print the confusion matrix and the two numbers. It's common to see 96 percent accuracy with 0 percent recall, and that single printout changes how you read every result from now on. Take a screenshot. Photo
-
4
Do the same for a regression problem with the mean as the baseline. Pick any numeric target, like house prices or bike rentals per hour. Compute the root mean squared error of predicting the mean every time, then of a fitted model. Report both. Also try predicting the median and note which baseline was harder to beat. Take a screenshot of the three errors. Photo
-
5
Find or make a case where the baseline wins. Shrink the training set to 30 rows, or add ten junk columns of random numbers, and refit. Somewhere in there the model will do worse on held-out rows than the baseline did. Take a screenshot of that result, then write the one-line format you'll use for every score from now on, something like 'accuracy 0.91 against a majority baseline of 0.88', and two sentences on why a model can lose to a constant. Photo