Skip to content

Instantly share code, notes, and snippets.

@Mengyuz
Created June 5, 2015 15:20
Show Gist options
  • Save Mengyuz/55974b763991a5dbfe87 to your computer and use it in GitHub Desktop.
Save Mengyuz/55974b763991a5dbfe87 to your computer and use it in GitHub Desktop.
import numpy as np
import scipy
import matplotlib.pyplot as plt
def plot_residuals(turnstile_weather, predictions):
'''
Using the same methods that we used to plot a histogram of entries
per hour for our data, why don't you make a histogram of the residuals
(that is, the difference between the original hourly entry data and the predicted values).
Try different binwidths for your histogram.
Based on this residual histogram, do you have any insight into how our model
performed? Reading a bit on this webpage might be useful:
http://www.itl.nist.gov/div898/handbook/pri/section2/pri24.htm
'''
plt.figure()
(turnstile_weather['ENTRIESn_hourly'] - predictions).hist()
return plt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment