Lion Cipher Lab
Train a classifier with scikit-learn
- AI Security
- Beginner
- ~45 min
- Free · no account required
Why it matters
Most people who touch AI only ever use a finished model. They never see the step that made it a model, which leaves the whole thing feeling like magic. It is not magic: a classifier is a function you fit to labeled examples and then test on examples it never saw. Training one yourself, end to end, in a few lines, is the fastest way to make AI stop being mysterious. It also teaches the discipline that separates people who trust models carefully from people who get burned: hold out a test set, read a confusion matrix instead of a single accuracy number, and know by name the ways a good-looking…
What you'll learn
- training a classifier end-to-end
- loading a built-in dataset
- train/test split and why a held-out test set matters
- training LogisticRegression and DecisionTree models
- predicting on unseen data
- reading accuracy, a confusion matrix, precision and recall
- spotting overfitting, train/test leakage and class imbalance
- why accuracy alone can mislead
Steps in this lab
- What it means to train a model
- Install scikit-learn, offline after this
- Load a built-in labeled dataset
- Split into train and test, and why
- Train a model and predict
- Evaluate: accuracy, confusion matrix, precision and recall
- The honest limits: overfitting, leakage, imbalance
- What you can now do that most people can't