Master of Data Science · Capstone research

TaxLens

An unsupervised anomaly-detection model trained on the ATO Individual Sample File 2022–23. It segments taxpayers into peer groups with K-Means, scores each return against its own group with an Isolation Forest, and explains every score with SHAP.

Undram JargalsaikhanMaster of Data Science capstone · September 2026
Trained on
321,890
taxpayer returns
ATO 2022–23 sample, 65 variables
Segmented into
8
peer groups
K-Means on income mix
Flagged
6,442
anomalies
Isolation Forest, top 2% of each group
Explained with
3
SHAP drivers per flag
named items from the return itself
Explore the pipeline stage by stage
STAGE 1 · Data processing

From 321,890 returns to eight peer groups

Input: ATO sample fileOutput: 55 features · 8 groups

The dataset

321,890
returns, a confidential 2% sample
65
variables: income, deductions, super, demographics
$58,241
median total income
62.9%
lodged through a tax agent
Figure 1. Eight key variables among the taxpayers who report them, log scale $1–$3m. Amounts span seven orders of magnitude, so the model uses sign(x)·ln(1+|x|). Population aggregates only.

Feature engineering — the twelve ratios

43 amount features survive screening; twelve scale-free ratios are added so that $10,000 means something different on a $30,000 salary than on a $300,000 one.

Income & deductions

Deductions÷ total income
Work expenses÷ salary
Gifts÷ total income
Taxable-income identity÷ expected taxable

Activity-specific

Rental deductions÷ gross rent
Business expenses÷ business income
Investment deductions÷ investment income
Personal super÷ total income

Filing controls

Tax-affairs cost÷ total income
PAYG instalments÷ total income
Items reportedcount of non-zero fields
Lodged via agent0 / 1

Peer groups — K-Means

Grouped on seven income-source shares plus scale. Deductions are deliberately kept out, so high claims cannot become "normal" by construction.

k = 8 is the best-separated choice
Silhouette by number of groups, 20,000-record sample.
Group size
Share of the 321,890 returns.
Figure 2. Silhouette 0.658, Davies–Bouldin 0.72; the smallest group still holds 4,223 returns, enough for its own forest. Clustering raw dollar amounts instead gives silhouette 0.05–0.13.
The groups separate in two principal components
20,000 taxpayers coloured by group; PC1 carries 24% of variance, PC2 14%.
Figure 3. Each group occupies its own region of the nine-feature composition space, projected to two dimensions. Labels mark group centroids; the wage group dominates, the rest fan out by income source.
What each group earns from
Mean share of total income by source. Darker = larger share.
Figure 4. Each group is 75–94% one income type on average. Occupation was never given to the algorithm, yet it aligns: 23% of the wage group are professionals, while 60–96% of the non-wage groups state no occupation.

Next · Stage 2 Isolation Forest →