Created
September 23, 2016 01:15
-
-
Save ckholmes5/154e89f47939e23a876503d9c9bd24a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Fitting linear regression model | |
def linear_regression(neighborhoods): | |
neighborhoods_regression = [] | |
for neighborhood in april.Neighborhood.unique(): | |
temp = april[april.Neighborhood == neighborhood] | |
if len(temp) > 500: | |
#Creating test set | |
test = temp['Taxi_Order'] + temp['Uber_Order'] | |
#Deleting unnecessary columns | |
del temp['Taxi_Order'] | |
del temp['Uber_Order'] | |
del temp['Min'] | |
del temp['Max'] | |
del temp['Neighborhood'] | |
del temp['Date'] | |
del temp['Uber_Share'] | |
del temp['Unnamed: 0'] | |
ols.train(temp, test) | |
neighborhoods_regression[neighborhood] = float(ols.predict(get_current_conditions())) | |
return neighborhoods_regression | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment