Given the sum of cards of a player in Blackjack, the model predicts the outcome of the game with 69% accuracy.
A RandomForestClassfier
was used to achieve the results with an accuracy of 69%. However, other two classification models that were tried and discarded were:
Classifier | Accuracy |
---|---|
Gaussian Naive Bayes | 61% |
Logistic Regression | 56% |
from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier(n_estimators = 10, criterion = 'gini', random_state = 0)
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
The Confusion Matrix
plotted below gives an estimate of the true positives and false negatives to help evaluate the performance of the model.
from sklearn.metrics import accuracy_score
accuracy = accuracy_score(y_test, y_pred).round(2)
print(accuracy)
https://www.kaggle.com/mojocolors/900000-hands-of-blackjack-results