Last active
August 18, 2019 14:31
-
-
Save a-agmon/3e56627c06e7c808bab5edf7693c096b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#fit the model | |
from xgboost import XGBClassifier | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import accuracy_score | |
model = XGBClassifier() | |
model.fit(x_train, y_train) | |
accuracy = accuracy_score(y_test, predictions) | |
print("Accuracy: %.2f%%" % (accuracy * 100.0)) | |
#evaluate the model | |
import sklearn.metrics as metrics | |
y_pred = model.predict(x_test) | |
predictions = [round(value) for value in y_pred] | |
# evaluate predictions | |
accuracy = accuracy_score(y_test, predictions) | |
print("Accuracy: %.2f%%" % (accuracy * 100.0)) | |
cm = confusion_matrix(y_test, y_pred) | |
print(cm) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment