The goal of the project is to use the census data to identify people that are most likely to donate to CharityML cause. This is done by constructing a model that accurately predicts whether an individual makes more than $50,000 a year or not. This is a supervised machine learning project. This should help CharityML create targeted marketing campaigns with the highest donations.
CharityML is a fictitious charity organization located in the heart of Silicon Valley that was established to provide financial support for people eager to learn machine learning. After nearly 32,000 letters were sent to people in the community, CharityML determined that every donation they received came from someone that was making more than $50,000 annually. To expand their potential donor base, CharityML has decided to send letters to residents of California, but to only those most likely to donate to the charity. With nearly 15 million working Californians, CharityML has brought you on board to help build an algorithm to best identify potential donors and reduce overhead cost of sending mail. Your goal will be evaluate and optimize several different supervised learners to determine which algorithm will provide the highest donation yield while also reducing the total number of letters being sent.
- Explore the census data and learn how it is organized and recorded
- Apply a series of transformations and pre-processing techniques to manipulate the data into a workable format
- Establish a benchmark for a solution to the problem
- Evaluate several supervised learners and consider which is best suited for project goal
- Optimize the selected model and present the solution to CharityML
- Finally, explore the chosen model and its predictions under the hood to see how well it is performing considering the data its been given
Metric | Naive Predictor | Unoptimized Model | Optimized Model |
---|---|---|---|
Accuracy Score | 0.2478 | 0.8639 | 0.8737 |
F-score | 0.2917 | 0.7461 | 0.7626 |
The optimized model achieved a little improvement in both accuracy and f-score as seen from the table above.
- We see more than three times improvement in accuracy score for the optimized model compared to the Naive Predictor.
- The optimized model also achieved more than twice the f-score compared to the Naive Predictor. These are really valuable gains!
- The following features are the most important for prediction:
- marital status
- education level
- relationship
- capital-gain
- capital-loss
This project requires Python 3.x and the following Python libraries installed:
You will also need to have software installed to run and execute an iPython Notebook
Code is provided in the finding_donors.ipynb
notebook file. You will also be required to use the included visuals.py
Python file and the census.csv
dataset file to complete your work. While some code has already been implemented to get you started, you will need to implement additional functionality when requested to successfully complete the project. Note that the code included in visuals.py
is meant to be used out-of-the-box and not intended for students to manipulate. If you are interested in how the visualizations are created in the notebook, please feel free to explore this Python file.
In a terminal or command window, navigate to the top-level project directory (that contains this README) and run one of the following commands:
ipython notebook finding_donors.ipynb
or
jupyter notebook finding_donors.ipynb
This will open the iPython Notebook software and project file in your browser.
The modified census dataset consists of approximately 32000 data points, with each datapoint having 13 features. This dataset is a modified version of the dataset published in the paper "Scaling Up the Accuracy of Naive-Bayes Classifiers: a Decision-Tree Hybrid", by Ron Kohavi. You may find this paper online, with the original dataset hosted on UCI.
Features
age
: Ageworkclass
: Working Class (Private, Self-emp-not-inc, Self-emp-inc, Federal-gov, Local-gov, State-gov, Without-pay, Never-worked)education_level
: Level of Education (Bachelors, Some-college, 11th, HS-grad, Prof-school, Assoc-acdm, Assoc-voc, 9th, 7th-8th, 12th, Masters, 1st-4th, 10th, Doctorate, 5th-6th, Preschool)education-num
: Number of educational years completedmarital-status
: Marital status (Married-civ-spouse, Divorced, Never-married, Separated, Widowed, Married-spouse-absent, Married-AF-spouse)occupation
: Work Occupation (Tech-support, Craft-repair, Other-service, Sales, Exec-managerial, Prof-specialty, Handlers-cleaners, Machine-op-inspct, Adm-clerical, Farming-fishing, Transport-moving, Priv-house-serv, Protective-serv, Armed-Forces)relationship
: Relationship Status (Wife, Own-child, Husband, Not-in-family, Other-relative, Unmarried)race
: Race (White, Asian-Pac-Islander, Amer-Indian-Eskimo, Other, Black)sex
: Sex (Female, Male)capital-gain
: Monetary Capital Gainscapital-loss
: Monetary Capital Losseshours-per-week
: Average Hours Per Week Workednative-country
: Native Country (United-States, Cambodia, England, Puerto-Rico, Canada, Germany, Outlying-US(Guam-USVI-etc), India, Japan, Greece, South, China, Cuba, Iran, Honduras, Philippines, Italy, Poland, Jamaica, Vietnam, Mexico, Portugal, Ireland, France, Dominican-Republic, Laos, Ecuador, Taiwan, Haiti, Columbia, Hungary, Guatemala, Nicaragua, Scotland, Thailand, Yugoslavia, El-Salvador, Trinadad&Tobago, Peru, Hong, Holand-Netherlands)
Target Variable
income
: Income Class (<=50K, >50K)