Created
September 23, 2016 01:22
-
-
Save ckholmes5/f66374f0209bd33261694379cd97035a 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
def trees(neighborhoods): | |
neighborhoods_trees = {} | |
for neighborhood in neighborhoods: | |
temp = april[april.Neighborhood == neighborhood] | |
if len(temp) > 500: | |
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'] | |
np.random.seed(1) | |
randomForest = ensemble.RandomForestClassifier() | |
randomForest.fit(temp, test) # fit | |
neighborhoods_trees[neighborhood] = (float(randomForest.predict(get_current_conditions()))) | |
return neighborhoods_trees | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment