Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# test the accuracy of each model using default hyperparameters
results = []
names = []
scoring = 'accuracy'
for name, model in models:
# fit the model with the training data, y_train).predict(X_test)
# make predictions with the testing data
predictions = model.predict(X_test)
# calculate accuracy
accuracy = accuracy_score(y_test, predictions)
# append the model name and the accuracy to the lists
# print classifier accuracy
print('Classifier: {}, Accuracy: {})'.format(name, accuracy))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment