-
-
Save amandaiglesiasmoreno/e0928eae6e1bc3bccad408b9ad00ccd6 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
# 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 | |
model.fit(X_train, 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 | |
results.append(accuracy) | |
names.append(name) | |
# 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