Skip to content

deep-diver/Enron-Data-Analysis

Repository files navigation

Data Analysis and Machine Learning on Enron Dataset

This notebook shows how data analysis on enron dataset can be done. The goal of the analysis is to find the best machine learning algorithm with the best precision and recal metric values. Each algorithms' job on the way is to correctly classify poi(person of interest) from the dataset. POIs are who I am interested in since I think they are strongly related to Enron Scandal. POIs are chosen mannually and provided by Udacity's "Intro to Machine Learning" course. You can think of this notebook as a part of the assignment for the final project from the course.

The way it is organized

  1. Choose features of my interest
  2. Perform basic data analysis
  3. Find outliers, and remove them when needed
  4. Perform various machine learning algorithms
  5. Compare each results
  6. Confirm the best result

Machine Learning Part

  1. Perform basic DecisionTree classifier on raw data
  2. Perform basic DecisionTree classifier on data that outliers are removed
  3. Define a function to measure accuracy, precision, and recall metrics
  4. Define a function to run Pipeline with SelectKBest, and GridSearchCV
  5. Run different kinds of ML algorithms with a number of different parameters
  • Decision Tree Classifier
  • Adaboost Classifier
  • Random Forest Classifier
  • Support Vector Machine Classifier
  • Gaussian Naive Bayse Classifier

Result

F1 Score Result

F1 Score Result


Accuracy Score Result

Accuracy Score Result

Conclusion

The best model I could find is 'Adaboost'. The parameters with the below, it did the best job.

  • feature list: 'poi', 'bonus'
  • algotirthm: 'SAMME.R'
  • learning rate: 0.05
  • number of estimators: 30

And the scores are

  • accuracy: 0.827
  • f1: 0.7159

This model achieved the best f1 score comparing to other models, DecisionTree, Gaussian Naive Bayes, Random Forest, and Support Vector Machine. While having the best f1 score, the number of feature used is only 2. I think it could mean this model is not overfitted much. Furthermore, it achieved the best accuracy as well in the group of other models under the same number of features.

Reference

conceptual study

programming reference

error reference