Skip to content
Learn Python with BNHR

Module 9 · Intermediate

Anomalies with machine learning

Module 9 of Python for Survey Statistics: features from survey rows, Isolation Forest, LOF and ECOD, detectors judged against known anomalies and rules, a random forest on last round's edits, and a large table scored. Its sections, its notebooks to read on the web, and the companion's solutions and explanations.

Module 9Level Intermediate
On this page
  1. Overview
  2. What you do
  3. The module’s notebooks
  4. Quizzes
  5. Certification and support

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.

  1. Features from survey rows: encoding, scaling, what to leave out
  2. Isolation Forest, LOF and ECOD: scores and contamination
  3. Judging detectors against known anomalies and rules; explaining a flag
  4. When you have labels: a random forest on last round's edits
  5. Scoring a large table with polars, DuckDB and Parquet

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

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.

Saved in this browser only

Certification and support

We offer additional resources, certificates, ongoing support, and other perks to those who join our instructor-led training.

Join an upcoming training to take this as an instructor-led course, or contact us to arrange one for your team or organization.

Something new

Identify results
LayerExplore a capstone
CapstoneCapstone
AboutThe capstone of Python Essentials, after module 7: in groups, a report on three barangays from their records, from the file to a written summary. Its sections and its notebook to read on the web.
CoursePython Essentials, free