/BlackJack-Outcome-Predictor

A machine learning model to predict the outcome of a Blackjack game based on the cards drawn by the player

Primary LanguagePython

🃏 Blackjack Win/Loss Predictor

Given the sum of cards of a player in Blackjack, the model predicts the outcome of the game with 69% accuracy.

Alt Text

⚙️ Implementation

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)

🚀 Results

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) 

IMG

📄 Dataset Source

https://www.kaggle.com/mojocolors/900000-hands-of-blackjack-results