Skip to content
← University

Income prediction and fairness on the Adult dataset

A team project that trains three classifiers to predict incomes above 50,000 dollars on the UCI Adult dataset, then measures how unequal their predictions are across sex and race.

Role
Team member, with three classmates
When
March 2026 to April 2026
Course
Artificial Intelligence
Stack
Python, pandas, scikit-learn, Matplotlib, Jupyter
Bar chart of the random forest's Gini feature importance, led by married civil spouse status, years of education, age and net capital

Context

The Adult dataset from the UCI Machine Learning Repository holds about 32,500 records from the 1994 US census, with age, education, occupation, marital status, sex, race and other attributes. The usual task is to predict whether a person earns more than 50,000 dollars a year. It is also a standard case study for fairness, because a model trained on historical data can learn and repeat the inequalities in it.

This was a four person project for the Artificial Intelligence course, developed in a shared Jupyter notebook.

What we did

Preprocessing. We removed the 2,399 records with missing values (about 30,160 remain), grouped related work classes (self employed, government, private), encoded categorical variables and split the data 80/20 into training and test sets.

Models. We trained and compared logistic regression, a random forest and a support vector machine, reporting accuracy, precision, recall, F1 score and confusion matrices. Accuracy was around 80% for logistic regression, 81% for the SVM and 82% for the random forest.

Fairness. We measured disparate impact: the rate of positive predictions for the unprivileged group divided by the rate for the privileged group, where values below 0.8 are commonly read as a sign of discrimination. The models scored about 0.30 for sex and 0.60 for race, both well below that threshold.

Ablation and feature importance. On the random forest we ranked features by Gini importance and removed the least relevant ones step by step to see how performance changed. Marital status (married to a civilian spouse), years of education, age and net capital came out as the strongest predictors.

Takeaways

Good accuracy says nothing about fairness: models that were right about 80% of the time still produced strongly unequal predictions across groups.

← All projects