Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Dataset Background

This dataset is a hybrid — it combines a real-world tax audit dataset with synthetically generated tax fraud cases.

The base audit records reflect genuine filing behaviour: income levels, deduction patterns, demographic attributes, and filing habits drawn from real audit data. However, the original audit dataset did not contain a sufficient number of confirmed fraud cases to train a supervised fraud detection model. To address this, synthetic fraud examples were generated and added to the dataset, simulating the kinds of anomalous patterns — inflated deductions, unusual credit claims, atypical filing behaviour — that are associated with fraudulent returns in practice.

The result is a dataset that preserves realistic distributional properties from real audits while providing enough fraud signal for model training. This hybrid nature has one important implication: model performance on this dataset may overestimate real-world performance, since synthetic fraud cases are by definition more "textbook" than the fraud patterns encountered in practice.


Quick Facts

Records 10,000
Columns 31 (27 used in modelling)
Fraud rate 10% (1,000 fraud cases)
Target variable fraud_flag
Year covered 2023

Target Variable

Column Type Description
fraud_flag int (0/1) Target. 1 = fraudulent return, 0 = legitimate. 10% of records are fraud.

Taxpayer Profile

Column Type Description
taxpayer_id string Unique identifier (e.g. TP006253). No predictive value — dropped before modelling.
age int Taxpayer age. Range: 18–84, mean ≈ 51.
filing_status string Marital/household status: Single, Married, Head of Household.
occupation_category string Broad job category: Management, Professional, Sales, Service, Manual Labor, Administrative, Technical, Self-employed.
industry_sector string Industry the taxpayer works in: Healthcare, Finance, Manufacturing, Transportation, Construction, Retail, Education, Technology, Hospitality, Other.
geographic_region string US region: Northeast, Southeast, Midwest, Southwest, West.
years_filing int How many years the taxpayer has been filing returns. Range: 1–39.
num_dependents int Number of dependents claimed. Range: 0–5.
self_employed int (0/1) Whether the taxpayer is self-employed.
foreign_income int (0/1) Whether the taxpayer reported any foreign income.
rental_income int (0/1) Whether the taxpayer reported rental income.
previous_audit_flag int (0/1) Whether the taxpayer has been audited before. ~10% of records.

Financial Figures

Column Type Description
income_reported float Total income reported (USD). Range: ~$3,500–$721,000, mean ≈ $74,900.
investment_income float Income from investments. Mean ≈ $7,671.
business_expenses float Business-related expenses claimed. Many records show $0 (non-self-employed filers).
deductions_claimed float Total deductions claimed. Mean ≈ $24,350.
charitable_contributions float Charitable donation deductions. Mean ≈ $4,022.
medical_expenses float Medical expense deductions. Mean ≈ $1,978.
education_expenses float Education-related deductions. Mean ≈ $1,982.
mortgage_interest float Mortgage interest deduction. Mean ≈ $8,022.
property_tax float Property tax deduction. Mean ≈ $1,988.
state_local_tax float State and local tax deduction. Mean ≈ $4,570.
tax_credits_claimed float Total tax credits claimed. Mean ≈ $5,024.

Filing Details

Column Type Description
filing_date string (date) Date the return was filed. All records are from 2023. Converted to filing_month before modelling.
filing_method string How the return was submitted: Electronic or Paper.
days_to_deadline int Days between filing date and the tax deadline. Negative values indicate late filing. Range: -1 to 104.

Derived Ratio Features (dropped before modelling)

These columns were computed directly from other columns already present in the dataset. Keeping them would introduce data leakage — the model could rely on the pre-computed ratios rather than learning from the underlying raw features, which would overstate performance.

Column Formula
deduction_to_income_ratio deductions_claimed / income_reported
credit_to_income_ratio tax_credits_claimed / income_reported
expense_per_dependent deductions_claimed / num_dependents
income_per_dependent income_reported / num_dependents

Preprocessing Summary

The following steps were applied before model training (see data_prep.ipynb):

  1. Dropped taxpayer_id — unique identifier with no predictive signal.
  2. Dropped the four derived ratio columns listed above — data leakage risk.
  3. Extracted filing_month from filing_date, then dropped filing_date — all records are from 2023, so the year carries no variance.
  4. Encoded categorical columns to integers: manual mapping for filing_status, filing_method, and geographic_region; dynamic mapping for occupation_category and industry_sector.
  5. Exported cleaned data to synthetic_tax_fraud_dataset_preprocessed.csv.

Note: the dynamic encoding for occupation_category and industry_sector depends on unique() ordering, which is not guaranteed to be consistent across runs. For a production pipeline, a fixed mapping or a saved LabelEncoder would be more robust.


Modelling Notes

  • Primary metric: PR-AUC and F1-score. With a 10% fraud rate, accuracy is misleading — a model that always predicts "no fraud" would still score 90%. Precision-Recall AUC is more informative under class imbalance.
  • Class imbalance handling was explored via three strategies: no balancing (baseline), SMOTE + undersampling to 20% and 33% fraud ratios, and class_weight='balanced'.
  • Threshold tuning was performed on the validation set — the default 0.5 threshold is rarely optimal on imbalanced data.
  • Train / validation / test split was done with stratification to preserve the fraud rate across all subsets. The test set was held out until final evaluation.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages