Machine learning finds rows unlike the others without a rule written for them. This module builds features from the survey’s tables, deciding what to leave out, and runs three unsupervised detectors from scikit-learn and PyOD. It judges each against the anomalies it knows and against module 8’s rules, with precision and recall, explains a flag, and says plainly where the rules already find everything.
When you have labels, a random forest learns from the 2021 round’s edit decisions; the module shows what those labels miss this round. The last section scores a table of 240,000 fishing units with polars, DuckDB and Parquet, chunk by chunk only where that gives the same answer.
What you do
Section titled “What you do”- Features from survey rows: encoding, scaling, what to leave out
- Isolation Forest, LOF and ECOD: scores and contamination
- Judging detectors against known anomalies and rules; explaining a flag
- When you have labels: a random forest on last round's edits
- Scoring a large table with polars, DuckDB and Parquet
The module’s notebooks
Section titled “The module’s notebooks”- 80_anomalies_ml.pyAnomalies with machine learningRead itCompanion · 8 exercises
The notebooks are in your course folder; here you can read them without running anything. For reference in any module: primer: from r to python and primer: survey sampling in one page and glossary.
Quizzes
- Check-inAt the end of the module. A short check on “Anomalies with machine learning”, and how ready you feel; its answers show as soon as you submit.Check-in: Anomalies with machine learning ↗
- Post-testAt the end of the course. The pre-test's questions again, so you can see what you learned. Its answers open with the passphrase given at the end of an instructor-led training.Python for Survey Statistics: the course test ↗
The quizzes are on BNHR Quizzes and count toward nothing. Learning on your own, a quiz opens as the self-paced one; while a training runs, it asks which training you are in.