Prediction of Earnings Based on Demographic and Employment Data

Similar documents
Python Machine Learning

Learning From the Past with Experiment Databases

Lecture 1: Machine Learning Basics

Assignment 1: Predicting Amazon Review Ratings

CS Machine Learning

Rule Learning With Negation: Issues Regarding Effectiveness

Rule Learning with Negation: Issues Regarding Effectiveness

(Sub)Gradient Descent

Machine Learning and Data Mining. Ensembles of Learners. Prof. Alexander Ihler

OPTIMIZATINON OF TRAINING SETS FOR HEBBIAN-LEARNING- BASED CLASSIFIERS

Predicting Student Attrition in MOOCs using Sentiment Analysis and Neural Networks

Model Ensemble for Click Prediction in Bing Search Ads

Probabilistic Latent Semantic Analysis

Linking Task: Identifying authors and book titles in verbose queries

Module 12. Machine Learning. Version 2 CSE IIT, Kharagpur

Introduction to Ensemble Learning Featuring Successes in the Netflix Prize Competition

Probability and Statistics Curriculum Pacing Guide

Twitter Sentiment Classification on Sanders Data using Hybrid Approach

System Implementation for SemEval-2017 Task 4 Subtask A Based on Interpolated Deep Neural Networks

A Case Study: News Classification Based on Term Frequency

Reducing Features to Improve Bug Prediction

Knowledge Transfer in Deep Convolutional Neural Nets

Disambiguation of Thai Personal Name from Online News Articles

School Size and the Quality of Teaching and Learning

The 9 th International Scientific Conference elearning and software for Education Bucharest, April 25-26, / X

Corpus Linguistics (L615)

WE GAVE A LAWYER BASIC MATH SKILLS, AND YOU WON T BELIEVE WHAT HAPPENED NEXT

Generative models and adversarial training

Chinese Language Parsing with Maximum-Entropy-Inspired Parser

Artificial Neural Networks written examination

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

College Pricing. Ben Johnson. April 30, Abstract. Colleges in the United States price discriminate based on student characteristics

Applications of data mining algorithms to analysis of medical data

Modeling function word errors in DNN-HMM based LVCSR systems

What Different Kinds of Stratification Can Reveal about the Generalizability of Data-Mined Skill Assessment Models

Essentials of Ability Testing. Joni Lakin Assistant Professor Educational Foundations, Leadership, and Technology

Defragmenting Textual Data by Leveraging the Syntactic Structure of the English Language

Probability estimates in a scenario tree

Algebra 1, Quarter 3, Unit 3.1. Line of Best Fit. Overview

Detecting English-French Cognates Using Orthographic Edit Distance

Why Did My Detector Do That?!

Australian Journal of Basic and Applied Sciences

Learning Structural Correspondences Across Different Linguistic Domains with Synchronous Neural Language Models

School Competition and Efficiency with Publicly Funded Catholic Schools David Card, Martin D. Dooley, and A. Abigail Payne

Softprop: Softmax Neural Network Backpropagation Learning

OCR for Arabic using SIFT Descriptors With Online Failure Prediction

WHEN THERE IS A mismatch between the acoustic

Learning to Rank with Selection Bias in Personal Search

The stages of event extraction

Learning Methods in Multilingual Speech Recognition

Entrepreneurial Discovery and the Demmert/Klein Experiment: Additional Evidence from Germany

Like much of the country, Detroit suffered significant job losses during the Great Recession.

Evaluation of Teach For America:

Calibration of Confidence Measures in Speech Recognition

Experiment Databases: Towards an Improved Experimental Methodology in Machine Learning

Instructor: Mario D. Garrett, Ph.D. Phone: Office: Hepner Hall (HH) 100

Math 96: Intermediate Algebra in Context

Impact of Cluster Validity Measures on Performance of Hybrid Models Based on K-means and Decision Trees

Iterative Cross-Training: An Algorithm for Learning from Unlabeled Web Pages

A Decision Tree Analysis of the Transfer Student Emma Gunu, MS Research Analyst Robert M Roe, PhD Executive Director of Institutional Research and

November 6, Re: Higher Education Provisions in H.R. 1, the Tax Cuts and Jobs Act. Dear Chairman Brady and Ranking Member Neal:

Modeling function word errors in DNN-HMM based LVCSR systems

SINGLE DOCUMENT AUTOMATIC TEXT SUMMARIZATION USING TERM FREQUENCY-INVERSE DOCUMENT FREQUENCY (TF-IDF)

Statewide Framework Document for:

arxiv: v1 [cs.cl] 2 Apr 2017

Research Update. Educational Migration and Non-return in Northern Ireland May 2008

Multi-label classification via multi-target regression on data streams

An Empirical Analysis of the Effects of Mexican American Studies Participation on Student Achievement within Tucson Unified School District

Evaluating and Comparing Classifiers: Review, Some Recommendations and Limitations

Switchboard Language Model Improvement with Conversational Data from Gigaword

Reinforcement Learning by Comparing Immediate Reward

Chapter 4 - Fractions

2 nd grade Task 5 Half and Half

TIMSS ADVANCED 2015 USER GUIDE FOR THE INTERNATIONAL DATABASE. Pierre Foy

SARDNET: A Self-Organizing Feature Map for Sequences

AGS THE GREAT REVIEW GAME FOR PRE-ALGEBRA (CD) CORRELATED TO CALIFORNIA CONTENT STANDARDS

Detecting Wikipedia Vandalism using Machine Learning Notebook for PAN at CLEF 2011

How to Judge the Quality of an Objective Classroom Test

STA 225: Introductory Statistics (CT)

Attributed Social Network Embedding

An Empirical Comparison of Supervised Ensemble Learning Approaches

On the Combined Behavior of Autonomous Resource Management Agents

Semi-Supervised Face Detection

Lesson M4. page 1 of 2

Human Emotion Recognition From Speech

Universidade do Minho Escola de Engenharia

Math Pathways Task Force Recommendations February Background

Learning By Asking: How Children Ask Questions To Achieve Efficient Search

Evolutive Neural Net Fuzzy Filtering: Basic Description

Copyright by Sung Ju Hwang 2013

ADVANCED MACHINE LEARNING WITH PYTHON BY JOHN HEARTY DOWNLOAD EBOOK : ADVANCED MACHINE LEARNING WITH PYTHON BY JOHN HEARTY PDF

A Case-Based Approach To Imitation Learning in Robotic Agents

THE PENNSYLVANIA STATE UNIVERSITY SCHREYER HONORS COLLEGE DEPARTMENT OF MATHEMATICS ASSESSING THE EFFECTIVENESS OF MULTIPLE CHOICE MATH TESTS

Source-monitoring judgments about anagrams and their solutions: Evidence for the role of cognitive operations information in memory

Activities, Exercises, Assignments Copyright 2009 Cem Kaner 1

A Bootstrapping Model of Frequency and Context Effects in Word Learning

Ricopili: Postimputation Module. WCPG Education Day Stephan Ripke / Raymond Walters Toronto, October 2015

Ryerson University Sociology SOC 483: Advanced Research and Statistics

Introduction to Questionnaire Design

University of Waterloo School of Accountancy. AFM 102: Introductory Management Accounting. Fall Term 2004: Section 4

Transcription:

1 Prediction of Earnings Based on Demographic and Employment Data Background I. INTRODUCTION The U.S. Department of Commerce launched Census Bureau to gather data on the country s earnings, employment and demographics [1]. Its mission is to become the main source of public data about the nation s people and economy. The Census data informs for instance on individual s age, level of education, employment type and income. This information could be hugely significant to businesses. For instance, think of the businesses which target individuals with high income. These businesses could use machine learning models trained on US Census data to predict someone s income. If this person s income is higher than a given threshold (for instance $50,000 per year), then the company decides to reach out to him. Better detection and segmentation of potential customers reduces marketing costs, increases conversion rate and thus improves return on investment [2]. Although the US Census Data has been available for decades, the US Census data received much traction over the past few years/months. Some companies realized how impactful this machine learning project could be. So data science consultants started working on it [2]. However, it turns out that most of these analyses were not made on the raw US Census Data Set. Instead, most relevant past work had been conducted on an extremely simplified version of the Census Data Set: the Adult Data Set. Goals I was amazed to discover that real-world machine learning models, meant to inform business decisions, were based on a crazily simplified version of the data! Instead of using the raw US Census Data Set, companies used the much simpler Adult Data Set [3]. In the Adult Data Set, most features have been deleted (16 features instead of 41). This undermines the US Adult Data Set ability to grasp trends and insights. Also, training examples have been ridiculously decreased (30,000 examples instead of 300,000). And the binary target variable (whether or not people earn more than $50,000 per year) has been artificially balanced (75%/25% imbalance instead of 94%/6%)! As a result, the Adult Data Set is extremely simple to work with. But this simplification might have come at the cost of losing some valuable information along the way. Working on the raw US Census Data Set - instead of the Adult Data Set - requires to handle more features, more training examples and to deal with extremely imbalanced classes. But this effort might lead to better performing machine learning models, that grasp more trends and insights in the data. Therefore, my goal is to use several machine learning models to make predictions about individuals annual income, based on the raw US Census Data Set (demographic and employment variables). This novel data set will require new approaches, especially to deal with the extremely imbalanced classes. If it turns out that my model performs better than previous models (that were trained on the simplified US Adult Data Set), then my novel project will be very significant to many businesses. Data II. DATA PRE-PROCESSING The raw US Census Dataset is a public dataset containing 41 employment/demographics variables for 300,000 individuals. I chose to focus on the raw 1994-1995 Census Data Set, because most of the relevant past work had been done on the simplified 1994-1995 US Adult Data Set: by working on the raw 1994-1995 Census Data Set, I will be able to compare my results to the previous simplified models. The target I tackled the following binary classification problem: based on the 41 employment/demographics variables of the US Census Data Set, how well can I predict if someone earns more than $50,000/year? In order to convert the raw data to useful features, I went through a series of pre-preprocessing steps. From Qualitative Data to Quantitative Data In the US Census dataset, 34 of the 41 attributes are qualitative. They contain a lot of information. However, most implementations of machine learning models cannot handle qualitative data. So the first step was to convert all non-numerical/categorical data to numerical data. This was done in two ways: - label encoding: categorical variables that take n different values are converted into one quantitative variable taking values 1...n. This is computationally efficient since only one feature is created. But it introduces an order in the data that might not make sense in the real world. For instance, the country of birth of each individual (string) is replaced by a number from 1 to 182 (182 countries appear in the dataset) - dummy (one-hot) encoding: categorical variables that take n different values are converted into n-1 indicator variables (one indicator variable per value). If n is large, this can

2 increase considerably the number of features. However, contrarily to label encoding, it does not introduce any kind of bias in the data. Note that I created n-1 (instead of n) dummy variables in order to avoid the dummy variable trap [4]. For instance, I converted the variable indicating marital status (married, divorced, separated, widowed, single) into 4 indicator variables. Standard Pre-Processing I then deleted the meaningless features - with 0 variance - since they offer no predictive power. The missing values were converted to aberrant values. And I normalized all the data to have mean 0 and standard deviation 1. Additionally, the target variable was turned into a proper binary (0/1) variable. Note that I could have opted for alternative strategies to handle missing data [5]. For instance, replacing missing values by the mean or the most common value. Predicting missing values. Or simply use classifiers/implementations that can handle missing values. increased computation time, especially for complex models. And too many features may lead to overfitting. I therefore implemented feature selection to decrease the number of input features. To keep only the most performant features, I ran sequential backward-based feature elimination. Features were selected based on their mean-squared ROC AUC score using 3-fold cross-validation. Feature selection was terminated when this performance metric starts decreasing. This procedure led to the conclusion that the optimal number of features to keep was 171. Covariate Shift in Train/Test Split? The training set consists of 200,000 examples. The remainder (100,000 examples) is for testing. The first key step was to make sure that there was no covariate shift in the data. Most supervised learning models make the assumption that training and test data follow the same underlying distribution. However, this assumption might turn out to be wrong and undermine many models. I designed the following experiment to detect a potential covariate shift. I added to the training and test data a train/test variable indicating whether they came from the train or test data set. I then built a model trying to predict this train/test variable. If there were a covariate shift, then this classifier should be able to distinguish the train data from the test data. The accuracy of this classifier was 66.6%. This corresponds to the baseline (66.6% of the data was training data). Therefore, I can confidently affirm that there was no covariate shift in the data. III. FEATURE ENGINEERING Computing New Features Based on the raw (pre-processed) variables of the data set, I computed basic features that will help the classifiers. For instance, I defined the net capital as the difference between capital gains and capital losses. This increased the number of features to 221. To judge the quality of feature engineering, I could look at the ranking of the top features of my classifiers: the net capital - a feature I engineered - ranked 3 rd out of 221. Success! Feature Selection The previous steps increased the number of features from 41 to 221. This enriched the raw dataset. But it considerably Fig. 1. features Evolution of the performance of the model with the number of Impact of Feature Engineering It is in general a good idea to start with a simple model that does not need much tuning - for instance a Random Forest with 30 estimators - while doing feature engineering. They are easy to implement and able to handle large amounts of variables, so they give valuable feedback on the quality of our work. Looking at the performance of the same random forest at each step of feature engineering enables us to quantify the improvements brought by each of these steps. Feature engineering increased our Random Forest s precision/recall from 0.70/0.35 to 0.72/0.39! Here are the top 5 features yielded after feature engineering and their relative importance. Rank Feature Importance of the feature (%) 1 Age 0.10 2 Dividends from stocks 0.07 3 Net capital 0.06 4 Occupation code 0.06 5 Industry code 0.05 Note that among the top 10 features, 5 were not present in (or could not be engineering from) the Adult Data Set: dividends from stocks, detailed occupation recode, detailed industry recode, number of persons worked for, industry of work code and number of weeks worked in year. This is a great news for the pertinence and novelty of my project. It

3 Fig. 2. Relative importance of the top 10 features Choosing an Appropriate Cross-validation Strategy Cross-validation can raise several issues when classes are extremely imbalanced. Indeed, there are relatively few training examples that belong to the class 1 of the target variable (labeled as 1 ). So, if I choose the cross-validations folds randomly, the training examples labeled as 1 might all end up in the same cross-validation fold. The other folds would be left with almost no no training example from the class 1 of the target variable. Classifiers would struggle to learn the class 1 on these folds. Therefore, I used stratified 3-Fold cross-validation to make sure that, in each fold, the proportion of 0/1 target variable is identical to that of the training set. Introducing Class Weights appears that by looking at the full 41 raw variables of the US Census Data Set instead of the simplified version of the Adult Data Set, we are able to grasp more patterns in the data. IV. FIGHTING IMBALANCED CLASSES The greatest difficulty of the project lied in the extremely imbalanced classes. The target variable is binary. It is equal to 0 for 94% of the data. This forced me to implement the following methods to fight the imbalance. This difficulty distinguishes my project (on the raw US Census Data Set) from previous existing project (on the simplified Adult Data Set where imbalance was not as bad) Fig. 3. Imbalanced classes Choosing Appropriate Metrics When classes are that much imbalanced, it is crucial to choose well the metric that tracks the performance of our classifiers. Especially, the accuracy metric is not relevant, because the accuracy baseline is 94%! Instead, I evaluated my classifiers based on their precision, recall, confusion matrices and ROC curves. When classifiers allow it, I penalized the most frequent class, by weighting each class inversely proportional to its frequency. For instance, with the logistic regression classifier, this increased ROC AUC by 0.13! V. PREDICTION MODELS AND METHODOLOGY In order to match the interest of companies, I formulated my learning task as the following binary classification: given the features than came from pre-processing/feature engineering, I would like to predict whether each individual has an income higher than $50,000 (the threshold $50,000 might vary from company to company). Logistic Regression Logistic regression is a natural choice as a first model. I ran logistic regression on the training and test set with L2 regularization. This baseline scored 0.72 ROC AUC (area under the TPR/FPP curve). I then opted for L1 regularization. When L2 regularization tended to give all the features diffuse importance, L1 regularization tended to shrink the importance of most of the features to 0, letting the classification rely mostly on a few number of features. More importantly, L1 regularization increased training time by 10x longer for comparable performance. So I opted for L2 regularization and fine-tuned the parameter that controls regularization strength C. I ran 3-fold cross-validation with values of C in the [0.01, 10 4 ] interval and chose the value of C that maximize the mean-squared ROC AUC cv score. This procedure found that C = 10 is the optimal regularization parameter. Note that, as expected, the performance of the classifier has a bell shape: when C is too low, the model is unable to grasp relevant patterns in the data (underfitting) and performance are low. And when C is too high, the performance tends to overfit and not generalize well, so performances are low too. Note that, as mentioned in the rubric Fighting Class Imbalance, the best logistic regression model on the test set used class weights to fight class imbalance (0.13 of ROC AUC!).

4 Fig. 4. Evolution of the ROC AUC (y axis) of the logistic regression with parameter C (x axis) Fig. 5. Evolution of the ROC AUC (y axis) of the random forest with the parameter maxfeatures (x axis) Having fine-tuned my logistic regression, in order to further improve the performance of my classifier, I decided to switch to tree-based classifiers. They might grasp relationships between the features and the target variable that a logistic regression could not perceive. Random Forests To capture patterns in the data that logistic regression might fail to detect, I opted for a model radically different from logistic regression. Random forests are meta-estimators that fit a given number of decision tree classifiers on various subsamples of the dataset. Fine tuning random forest was made in 2 steps. First, fine-tune the parameter that controls the number of estimators (the number of decision trees). It turned out that ROC AUC kept increasing with the number of estimators. So, my role was to find a tradeoff between computation time and performance. I decided to set the number of estimators to 100: after 100 trees, adding new trees increases the performance of the model, but extremely slowly. Second, random forests fit decision tree classifiers based on random sub-samples of the features. I fine-tuned the parameter (maxfeatures) controlling the size of this subsample. Setting this parameter to 20% of the whole features turned out to be optimal. This does slightly better than the heuristic [6] that recommends setting maxfeature to the root of the total number of features - 13% in our case. VI. RESULTS AND DISCUSSION The following figure shows the performances of my finetuned models. The primary error metric is the precision-recall curve: Logistic Regression and Random Forest seem to have comparable performances based on this metric. The curve might even suggest that Random Forest slightly outperform Logistic Regression. However, looking at a second performance metric will help us understand much better the dynamics of the two models and compare them: the ROC curve. Each point of the ROC curve Fig. 6. Precision-recall curves of the Logistic Regression and Random Forests corresponds to a classification decision threshold. By default, this threshold is set to 0.5. In other words, for a given test example, if P r(targetvariableequals1) is higher than 0.5, then the classifier will output 1. Setting this threshold closer to 1 improves precision, setting it closer to 0 improves recall. I decided to set the classification decision threshold to the point of the ROC curve that is closer to the top-right corner. Finally, the area under the ROC curve leaves no doubt about the best model for our classification tast: Logistic Regression scores a ROC AUC of 0.84 when Random Forest scores ROC AUC of 0.76. Figure 7 is the ROC curve of the Logistic Regression, once fine-tuned and once it includes class weights. VII. ENSEMBLE LEARNING In order to leverage the strengths of our fine-tuned classifiers (Logistic Regression and Random Forest), I opted for an ensemble learning method. A grid-searched Logistic Regression combined the predictions of the individual models (fine tuned Logistic Regression and Random Forest) and leveraged their strengths.

5 [6] Classification and association rules for census income data https://mathematicaforprediction.wordpress.com/2014/03/30/ classification-and-association-rules-for-census-income-data/ [7] Learning Fair Classifiers https://arxiv.org/pdf/1507.05259.pdf [8] Ballpark Learning: Estimating Labels from Rough Group Comparisons http://www.hyadatalab.com/papers/shahaf-hope-pkdd16.pdf Fig. 7. ROC AUC of the fine-tuned logistic regression The result was slightly disappointing: it improved our ROC AUC 0.841 to 0.845. Theoretically, ensemble learning methods should be able to perform much better than individual classifiers. Therefore, I see two avenues to further increase the performances of the model: - adding new models to the stacking that will bring new insights (for instance discriminant analysis models, Neural Networks that are universal approximators) - changing the metamodel that performs the ensemble learning. The current version uses a Logistic Regression as a metamodel. With more computation time/power, we could replace it by a more complex model (for instance the tree-based boosting classifier XGBoost) Note: Ensemble learning methods like stacking require a validation set: I split the training set (200,000 examples) between a working set (150,000) and a validation set (50,000). VIII. CONCLUSION This elegant solution - based on rich pre-processing, feature engineering, optimization of individual classifiers and ensemble learning enabled us to increase the ROC AUC from 0.62 to 0.845. This challenging project led me to implement novel methods to deal extremely with imbalanced classes. Previous model that were trained on simplified versions of the data Census Data Set (the Adult Data Set) reached ROC AUC of 0.81. The novel improvement could be highly significant for the businesses mentioned in the introduction. It came at the expense of handling more features, more examples and extreme class imbalance, which made the project challenging. REFERENCES [1] U.S. Census Bureau https://www.commerce.gov/doc/us-census-bureau. [2] Predicting earning potential on Adult Dataset http://www. dataminingmasters.com/uploads/studentprojects/earning potential report.pdf [3] Adult Data Set http://archive.ics.uci.edu/ml/datasets/adult [4] Dummy variable trap in regression models http://www.algosome.com/ articles/dummy-variable-trap-regression.html [5] How to tune RF parameters in practice https://www.kaggle.com/forums/ f/15/kaggle-forum/t/4092/how-to-tune-rf-parameters-in-practice