Skip to content

Instantly share code, notes, and snippets.

@kperry2215
Last active July 31, 2019 04:08
Show Gist options
  • Save kperry2215/414627f322e8339ecb965b0c9de02b68 to your computer and use it in GitHub Desktop.
Save kperry2215/414627f322e8339ecb965b0c9de02b68 to your computer and use it in GitHub Desktop.
#Plug in optimized model parameters into final RF model
rf = RandomForestClassifier(n_estimators=1100,
max_depth=100,
random_state = 1500)
#Fit the model
rf.fit(train_features, train_labels)
# Use the forest's predict method on the test data
print(confusion_matrix(test_labels,
rf.predict(test_features),
labels=['Hour 8', 'Hour 9', 'Hour 10',
'Hour 14', 'Hour 15', 'Hour 16',
'Hour 17', 'Hour 18', 'Hour 19',
'Hour 20', 'Hour 21']))
accuracy_score(test_labels, rf.predict(test_features), normalize=True, sample_weight=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment