{ "metadata": { "name": "", "signature": "sha256:bcb2bcf3bc425c192db3b3d36a4e3cf7c2fb0be727ca8d5f4f5f039a7b445356" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/outliers/1.jpg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Outlier in datapoints is normally occurs. It probably some mistyped data from input of other people (e.g. 200 instead of 20). In this plot we see there's outliers that drawn outside the trend of the data. This cause the linear regression, if outliers included, to draw the linear model in such a terrible way. In this case, to best minimize the least squared error, the model would choose the top line.\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/outliers/2.jpg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Outliers may caused of one of the above.\n", "\n", "* It could be sensor malfunction, in this case it often happen with in robotics field situation\n", "* Data Entry Errors, everytime there's input by human, there's always human error\n", "* Aliens may unlikely\n", "* Freak Event, that could be sometimes happen if for example in fraud detection.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/outliers/3.jpg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "One way to avoid the outliers is byusing Outlier Detection. Suppose we have 10 training examples. We're performing our usual algorithm, in this case linear regression. After that remove 10% of the training examples that have the highest residual error. And finally train again.In this example we have remove 1 outliers using Outlier Detection/Outlier Rejection" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now keep in mind that, sometimes it's outlier that we want to find, sometimes called Freak Event. For Anomaly Detection for example, we want to find fault cpu, in thousands of cpu creation in the process. Or the case of Fraud Detection. In this case, these outliers are the we are pay attention to." ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Mini Project" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As usual, because this blog post are the note that I have taken from Udacity course, you can see the link of the course for this note at the bottom of the page. Here I attack some of the problem they have at their mini project." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This project has two parts. In the first part, you will run a regression, and identify and remove the 10% of points that have the largest residual errors. Then you\u2019ll remove those outliers from the dataset and refit the regression, just like the strategy that Sebastian suggested in the lesson videos.\n", "\n", "In the second part, you will get acquainted with some of the outliers in the Enron finance data, and learn if/how to remove them." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Sebastian described to us an algorithm for improving a regression, which you will implement in this project. You will work through it in the next few quizzes. To summarize, what you'll do is fit the regression on all training points discard the 10% of points that have the largest errors between the actual y values, and the regression-predicted y values refit on the remaining points.\n", "\n", "Start by running the starter code (outliers/outlier_removal_regression.py) and visualizing the points. A few outliers should clearly pop out. Deploy a linear regression, where net worth is the target and the feature being used to predict it is a person\u2019s age (remember to train on the training data!).\n", "\n", "The \u201ccorrect\u201d slope for the main body of data points is 6.25 (we know this because we used this value to generate the data); what slope does your regression have?" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load outlier_removal_regression.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "%pylab inline" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "#!/usr/bin/python\n", "\n", "import random\n", "import numpy\n", "import matplotlib.pyplot as plt\n", "import pickle\n", "\n", "from outlier_cleaner import outlierCleaner\n", "\n", "\n", "### load up some practice data with outliers in it\n", "ages = pickle.load( open(\"practice_outliers_ages.pkl\", \"r\") )\n", "net_worths = pickle.load( open(\"practice_outliers_net_worths.pkl\", \"r\") )\n", "\n", "\n", "\n", "### ages and net_worths need to be reshaped into 2D numpy arrays\n", "### second argument of reshape command is a tuple of integers: (n_rows, n_columns)\n", "### by convention, n_rows is the number of data points\n", "### and n_columns is the number of features\n", "ages = numpy.reshape( numpy.array(ages), (len(ages), 1))\n", "net_worths = numpy.reshape( numpy.array(net_worths), (len(net_worths), 1))\n", "from sklearn.cross_validation import train_test_split\n", "ages_train, ages_test, net_worths_train, net_worths_test = train_test_split(ages, net_worths, test_size=0.1, random_state=42)\n", "\n", "### fill in a regression here! Name the regression object reg so that\n", "### the plotting code below works, and you can see what your regression looks like\n", "\n", "\n", "try:\n", " plt.plot(ages, reg.predict(ages), color=\"blue\")\n", "except NameError:\n", " pass\n", "plt.scatter(ages, net_worths)\n", "plt.show()\n", "\n", "\n", "### identify and remove the most outlier-y points\n", "cleaned_data = []\n", "try:\n", " predictions = reg.predict(ages)\n", " cleaned_data = outlierCleaner( predictions, ages, net_worths )\n", "except NameError:\n", " print \"your regression object doesn't exist, or isn't name reg\"\n", " print \"can't make predictions to use in identifying outliers\"\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "### only run this code if cleaned_data is returning data\n", "if len(cleaned_data) > 0:\n", " ages, net_worths, errors = zip(*cleaned_data)\n", " ages = numpy.reshape( numpy.array(ages), (len(ages), 1))\n", " net_worths = numpy.reshape( numpy.array(net_worths), (len(net_worths), 1))\n", "\n", " ### refit your cleaned data!\n", " try:\n", " reg.fit(ages, net_worths)\n", " plt.plot(ages, reg.predict(ages), color=\"blue\")\n", " except NameError:\n", " print \"you don't seem to have regression imported/created,\"\n", " print \" or else your regression object isn't named reg\"\n", " print \" either way, only draw the scatter plot of the cleaned data\"\n", " plt.scatter(ages, net_worths)\n", " plt.xlabel(\"ages\")\n", " plt.ylabel(\"net worths\")\n", " plt.show()\n", "\n", "\n", "else:\n", " print \"outlierCleaner() is returning an empty list, no refitting to be done\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[49, 21, 32, 30, 53, 51, 61, 23, 39, 21]\n", "[[49]\n", " [21]\n", " [32]\n", " [30]\n", " [53]\n", " [51]\n", " [61]\n", " [23]\n", " [39]\n", " [21]]\n" ] }, { "metadata": {}, "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEACAYAAAC6d6FnAAAABHNCSVQICAgIfAhkiAAAAA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gBfIveMexL+bMAJzlfkYNv\n5U8IIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIcT/A0n7tgoTHHVYAAAAAElFTkSuQmCC\n", "text": [ "" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "outlierCleaner() is returning an empty list, no refitting to be done\n" ] } ], "prompt_number": 128 }, { "cell_type": "code", "collapsed": false, "input": [ "from sklearn import linear_model" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "reg = linear_model.LinearRegression()" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "reg.fit(ages_train,net_worths_train)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 8, "text": [ "LinearRegression(copy_X=True, fit_intercept=True, normalize=False)" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "The slope of the regression is" ] }, { "cell_type": "code", "collapsed": false, "input": [ "reg.coef_[0][0]" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 57, "text": [ "5.0779306434402569" ] } ], "prompt_number": 57 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "What is the score you get when using your regression to make predictions with the test data?" ] }, { "cell_type": "code", "collapsed": false, "input": [ "reg.score(ages_test,net_worths_test)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 17, "text": [ "0.87826247036646721" ] } ], "prompt_number": 17 }, { "cell_type": "markdown", "metadata": {}, "source": [ "In outliers/outlier_cleaner.py, you will find the skeleton for a function called outlierCleaner() that you will fill in with a cleaning algorithm. It takes three arguments: predictions is a list of predicted targets that come from your regression, ages is the list of ages in the training set, and net_worths is the actual value of the net worths in the training set. There should be 90 elements in each of these lists (because the training set has 90 points in it). Your job is to return a list called cleaned_data that has only 81 elements in it, which are the 81 training points where the predictions and the actual values (net_worths) have the smallest errors (90 * 0.9 = 81). The format of cleaned_data should be a list of tuples, where each tuple has the form (age, net_worth, error). \n", "\n", "Once this cleaning function is working, you should see the regression result changes. What is the new slope? Is it closer to the \u201ccorrect\u201d result of 6.25?\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load outlier_cleaner.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 18 }, { "cell_type": "code", "collapsed": false, "input": [ "#!/usr/bin/python\n", "\n", "\n", "def outlierCleaner(predictions, ages, net_worths):\n", " \"\"\"\n", " clean away the 10% of points that have the largest\n", " residual errors (different between the prediction\n", " and the actual net worth)\n", "\n", " return a list of tuples named cleaned_data where \n", " each tuple is of the form (age, net_worth, error)\n", " \"\"\"\n", " \n", " #calculate the error,make it descend sort, and fetch 90% of the data\n", " \n", " errors = (net_worths-predictions)**2\n", " cleaned_data =zip(ages,net_worths,errors)\n", " cleaned_data = sorted(cleaned_data,key=lambda x:x[2][0], reverse=True)\n", " limit = int(len(net_worths)*0.1)\n", " \n", " \n", " return cleaned_data[limit:]\n", "\n" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 130 }, { "cell_type": "code", "collapsed": true, "input": [ "clf_after_cleaned = linear_model.LinearRegression()" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 144 }, { "cell_type": "code", "collapsed": false, "input": [ "cleaned_d = outlierCleaner(reg.predict(ages_train),ages_train,net_worths_train)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 145 }, { "cell_type": "code", "collapsed": false, "input": [ "age_cleaned = numpy.array([e[0] for e in cleaned_d])" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 147 }, { "cell_type": "code", "collapsed": false, "input": [ "net_worth_cleaned = numpy.array([e[1] for e in cleaned_d])" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 148 }, { "cell_type": "code", "collapsed": false, "input": [ "clf_after_cleaned.fit(age_cleaned,net_worth_cleaned)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 149, "text": [ "LinearRegression(copy_X=True, fit_intercept=True, normalize=False)" ] } ], "prompt_number": 149 }, { "cell_type": "code", "collapsed": false, "input": [ "clf_after_cleaned.coef_" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 151, "text": [ "array([[ 6.36859481]])" ] } ], "prompt_number": 151 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "The slope is 6.3, and yes it's closer to 6.5" ] }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "And the score is" ] }, { "cell_type": "code", "collapsed": false, "input": [ "clf_after_cleaned.score(ages_test,net_worths_test)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 153, "text": [ "0.98318945539553215" ] } ], "prompt_number": 153 }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the mini-project for the regressions lesson, you used a regression to predict the bonuses for Enron employees. As you saw, even a single outlier can make a big difference on the regression result. There was something we didn\u2019t tell you, though, which was that the dataset we had you use in that project had already been cleaned of some significant outliers. Identifying and cleaning away outliers is something you should always think about when looking at a dataset for the first time, and now you\u2019ll get some hands-on experience with the Enron data.\n", "\n", "You can find the starter code in outliers/enron_outliers.py, which reads in the data (in dictionary form) and converts it into a sklearn-ready numpy array. Since there are two features being extracted from the dictionary (\u201csalary\u201d and \u201cbonus\u201d), the resulting numpy array will be of dimension N x 2, where N is the number of data points and 2 is the number of features. This is perfect input for a scatterplot; we\u2019ll use the matplotlib.pyplot module to make that plot. (We\u2019ve been using pyplot for all the visualizations in this course.) Add these lines to the bottom of the script to make your scatterplot:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load enron_outliers.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 204 }, { "cell_type": "code", "collapsed": false, "input": [ "#!/usr/bin/python\n", "\n", "import pickle\n", "import sys\n", "import matplotlib.pyplot\n", "sys.path.append(\"../tools/\")\n", "from feature_format import featureFormat, targetFeatureSplit\n", "\n", "\n", "### read in data dictionary, convert to numpy array\n", "data_dict = pickle.load( open(\"../final_project/final_project_dataset.pkl\", \"r\") )\n", "features = [\"salary\", \"bonus\"]\n", "data = featureFormat(data_dict, features)\n", "\n", "\n", "### your code below\n", "print data.max()\n", "for point in data:\n", " salary = point[0]\n", " bonus = point[1]\n", " matplotlib.pyplot.scatter( salary, bonus )\n", "\n", "matplotlib.pyplot.xlabel(\"salary\")\n", "matplotlib.pyplot.ylabel(\"bonus\")\n", "matplotlib.pyplot.show()\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "97343619.0\n" ] }, { "metadata": {}, "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEVCAYAAAAckrn/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFu5JREFUeJzt3XmUVOWdh/GnoEFoEIHBGMA4PQHGuICjMwEcHa2oEyGL\nxmDiGEyOqAnHqMlJMoqYRPvMZNMkkxw1UYJLOpOMaIwLxjUuNTFiJKgNKCJLgsPiHlcWBan5471N\nl0Uvb9Fddau6n885ffreum9X/bw2/a33fe97CyRJkiRJkiRJkiRJkiRJkiT1cNcAzwNLI9qOBR4E\nHgcWA1PLWJckqQr9C3AwcaHxc2Bmsr0f8Jcy1SRJPVKftAvoBg8CrxQ9Nga4E1gE/B7YN3n8WWCP\nZHsosL4SBUqSqksD7+5p3EcYigKYlOwDDAGeBNYCfyX0UCRJvUwDraExGNhEmLdo+XoyOXYV8JVk\ne3LB45KkXqSB1tAYAmxop90yYHTB/mpgRPnKkqSeJe05jc6ufJpOuMppCfAQMCHiOV8nTHCfmOxn\nCn5uOXBMsr0fMAB4qeSqJUmp6OzKp0NpnbieAvyxjTbXEXoWbxPmKmYQeh53As2EIahvJG3HALnk\n8cdpDRBJUo1oIO5y2WHAuvKWIknqSNrDU6U4Hbgj7SIkSelqoPOexocIk9jDy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"cell_type": "markdown", "metadata": {}, "source": [ "As you can see, visualization is one of the most powerful tools for finding outliers!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There\u2019s one outlier that should pop out to you immediately. Now the question is to identify the source. We found the original data source to be very helpful for this identification; you can find that PDF in final_project/enron61702insiderpay.pdf \n", "What\u2019s the name of the dictionary key of this data point? (e.g. if this is Ken Lay, the answer would be \u201cLAY KENNETH L\u201d)." ] }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "TOTAL" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Well, that makes sense. The total of a column isn't going to be close to the mean of that column ..." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Does this outlier seem like a data point that we should include when running machine learning on this dataset? Or should we remove it?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Yes, the spreadsheet added up all the data points for us, and we need to take that \"point\" out." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A quick way to remove a key-value pair from a dictionary is the following line: dictionary.pop( key, 0 ) Write a line like this (you\u2019ll have to modify the dictionary and key names, of course) and remove the outlier before calling featureFormat(). Now rerun the code, so your scatterplot doesn\u2019t have this outlier anymore. Are all the outliers gone?" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#!/usr/bin/python\n", "\n", "import pickle\n", "import sys\n", "import matplotlib.pyplot\n", "sys.path.append(\"../tools/\")\n", "from feature_format import featureFormat, targetFeatureSplit\n", "\n", "\n", "### read in data dictionary, convert to numpy array\n", "data_dict = pickle.load( open(\"../final_project/final_project_dataset.pkl\", \"r\") )\n", "features = [\"salary\", \"bonus\"]\n", "\n", "data_dict.pop('TOTAL',0)\n", "\n", "data = featureFormat(data_dict, features)\n", "\n", "\n", "### your code below\n", "print data.max()\n", "for point in data:\n", " salary = point[0]\n", " bonus = point[1]\n", " matplotlib.pyplot.scatter( salary, bonus )\n", "\n", "matplotlib.pyplot.xlabel(\"salary\")\n", "matplotlib.pyplot.ylabel(\"bonus\")\n", "matplotlib.pyplot.show()\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "8000000.0\n" ] }, { "metadata": {}, "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAEVCAYAAADHKRPdAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VNXdx/HPzGSdCUnYJOyr7LuKiAhRQUBRUESlxYJa\nF7StWndtFZ6qtfaptRWtGyAqD1g3XEARhNTKpqIQZN9X2ZeE7Jk5zx/3JgwxQAIzczPk+3698uLe\nO3f5zZ3h/uaec+45ICIiIiIiIiIiIiIiIiIiIiIiIiIiIlIlTAR2A8srsO5zwA/23xrgYBjjEhGR\nKHMR0I2KJZRgvwFeD304IiISzZpxbEJpCXwGfAd8BbQpZ5sFwKVhj0xERKJKM45NKF8Crezp8+35\nYE2BnYAr7JGJiAgxTgdwipKAC4B3g5bFlVnnBvt1E6mgREQkOjTj6B1KMtbdx4l8D/QMZ0AiInKU\n2+kATlEWsAm41p53AZ2DXm8L1AQWRTguERGp4qZi3ZEUAtuAm7DuWD4DlgIrgD8Erf8E8HRkQxQR\nERERERERERERkTNIVDyj0aVLF7Ns2TKnwxARiTbLgK6ROlhUtPJatmwZxpio/XviiSccj6G6xh/N\nsSt+5/+iPX6gSySv1VGRUEREpOpTQhERkZBQQomA9PR0p0M4LdEcfzTHDorfadEef6RFRaU8YOzy\nQBERqSCXywURvM7rDkVEREJCCUVEREJCCUVEREJCCUVEREJCCUVEREJCCUVEREJCCUVEREJCCUVE\nREJCCUVEREJCCUVEREJCCUVEREJCCUVEREIi3AllILAaWAc8VM7rdYDPgaXAj8DoMMcjIiJhEs6E\n4gHGYyWV9sAIoF2ZdX4D/IA1RGU68DcgJowxSRQxxvDiiy/TqVNvzjnnEmbMmOF0SCJyAuFMKD2A\n9cBmoAiYBgwps85PQLI9nQzsB4rDGJNEkZdeeoUHH/wnP/44lu+//w3Dh9/CvHnznA5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YfZ91wicVKJm9hFXmB9SstzZ6uj3XRhvB/DpV9772Aq4BNwFTgEvt9REv82+2/b+35\n97ASy64oif9cYIG9v2KsSuELoij+Ek59X0J13RlN9blmVspArBYjdcosL6lgisMqJtjA0V+ki7HK\n/Vz8vIKppNzvBo6tYNqIdSJqBk2DVcF0vT39MuGvYIrBei/NsN5bpCvlXcCbWMVGwZ7laPnrw/y8\noi/cn8Op6MvRHyXRFP9XQGt7eqwde7TE3wWrdWCifdzJwF1REH8zfl4p72S8lbnulI29ul0zK2Ud\nsAWrCOMHjrY4AHgUq6XCamBA0PKSJnDrgX8GLY/HerMlTeCaBb12k718HVarlBLBTeDeITJN4AZh\nVWyux6pIi6TeWOWfSzl6zgdifYHmUH4zykh8DqeiL0dbeUVT/F2w7lCCm31GU/wPcrTZ8GSs/zNV\nOf6pWPU9hVj1BTdVgXgret0pG/vNVM9rpoiIiIiIiIiIiIiIiIiIiIiIiIiIiFRtHqcDEIlCb2D9\n31l1kvVEqhWnOocUiWaV7RNKP9ykWlBCEbH4gBlYPQssxxoH4o9Y40ssB145znaPH2edDKxub77F\n6txvI1Z3PADJ9rwSjYjIGWgY8GrQfDJW30Yl3sTqARmsLumH2dPHW2ceMD7otYnAEHv6NqzR+ETO\nKLpDEbFkYvWW/QxWP2hZWD0cL7JfuwSrU74SJUVeJ1rnnaDp17H6TAKrB9lJIY1epAqIOfkqItXC\nOqxByK4AngTmYvXQeg5Wt91PAAlltkkAXjzBOjlB0wuwOuRLxyrqWhni+EUcpzsUEUt9IB9r/Pq/\nYiUXgzVmRBIwvJxtSpLHidYJ9qa9/4khiFekytEdioilE1YiCWB1IT4GaxzvH7EGlVpczjaHsIb2\nPdE6wf4P6+5namhCFhGR6uparHFFRERETtkLWIM8tXI6EBERERERERERERERERERERERERERERGR\nU/T/+G2eoOfFJG8AAAAASUVORK5CYII=\n", "text": [ "" ] } ], "prompt_number": 212 }, { "cell_type": "markdown", "metadata": {}, "source": [ "We see 4 more outliers, although none that are as waaaayyy out there as the last example (the \"total\" line)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We would argue that there\u2019s 4 more outliers to investigate; let's look at a couple of them. Two people made bonuses around 6-8 million dollars, and a salary of over 1 million dollars; in other words, they made out like bandits. What are the names associated with those points?" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from pprint import pprint" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 214 }, { "cell_type": "code", "collapsed": false, "input": [ "outliers = []\n", "for key in data_dict:\n", " val = data_dict[key]['salary']\n", " if val == 'NaN':\n", " continue\n", " outliers.append((key,int(val)))\n", "\n", "pprint(sorted(outliers,key=lambda x:x[1],reverse=True)[:2])" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[('SKILLING JEFFREY K', 1111258), ('LAY KENNETH L', 1072321)]\n" ] } ], "prompt_number": 238 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Would you guess that these are typos or weird spreadsheet lines that we should remove, or that there\u2019s a meaningful reason why these points are different? (In other words, should they be removed before we, say, try to build a POI identifier?)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Yes! They're two of Enron's biggest bosses, and definitely people of interest." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> **REFERENCE**:\n", "\n", "> * https://www.udacity.com/course/viewer#!/c-ud120/l-2269418543/e-3021528630/m-3013588596" ] } ], "metadata": {} } ] }