From a336f4abfe071e73ae836a11487af49189701be9 Mon Sep 17 00:00:00 2001 From: Aviral Garg <105068445+aviralgarg05@users.noreply.github.com> Date: Sun, 21 Jul 2024 08:27:26 +0000 Subject: [PATCH] Changes Updated --- .../AdaBoost.ipynb | 0 .../Artificial Neural Network.ipynb | 0 .../Deep Neural Network.ipynb | 0 .../Multi Layer Perceptron.ipynb | 0 .../Output Code Classifier.ipynb | 0 .../Random Forest.ipynb | 0 .../Regression.ipynb | 0 .../SVM.ipynb | 0 Poker Hand Prediction/README.md | 74 +++++++++++-------- 9 files changed, 42 insertions(+), 32 deletions(-) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/AdaBoost.ipynb (100%) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/Artificial Neural Network.ipynb (100%) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/Deep Neural Network.ipynb (100%) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/Multi Layer Perceptron.ipynb (100%) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/Output Code Classifier.ipynb (100%) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/Random Forest.ipynb (100%) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/Regression.ipynb (100%) rename Poker Hand Prediction/{Poker Hand Prediction => Notebooks}/SVM.ipynb (100%) diff --git a/Poker Hand Prediction/Poker Hand Prediction/AdaBoost.ipynb b/Poker Hand Prediction/Notebooks/AdaBoost.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/AdaBoost.ipynb rename to Poker Hand Prediction/Notebooks/AdaBoost.ipynb diff --git a/Poker Hand Prediction/Poker Hand Prediction/Artificial Neural Network.ipynb b/Poker Hand Prediction/Notebooks/Artificial Neural Network.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/Artificial Neural Network.ipynb rename to Poker Hand Prediction/Notebooks/Artificial Neural Network.ipynb diff --git a/Poker Hand Prediction/Poker Hand Prediction/Deep Neural Network.ipynb b/Poker Hand Prediction/Notebooks/Deep Neural Network.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/Deep Neural Network.ipynb rename to Poker Hand Prediction/Notebooks/Deep Neural Network.ipynb diff --git a/Poker Hand Prediction/Poker Hand Prediction/Multi Layer Perceptron.ipynb b/Poker Hand Prediction/Notebooks/Multi Layer Perceptron.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/Multi Layer Perceptron.ipynb rename to Poker Hand Prediction/Notebooks/Multi Layer Perceptron.ipynb diff --git a/Poker Hand Prediction/Poker Hand Prediction/Output Code Classifier.ipynb b/Poker Hand Prediction/Notebooks/Output Code Classifier.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/Output Code Classifier.ipynb rename to Poker Hand Prediction/Notebooks/Output Code Classifier.ipynb diff --git a/Poker Hand Prediction/Poker Hand Prediction/Random Forest.ipynb b/Poker Hand Prediction/Notebooks/Random Forest.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/Random Forest.ipynb rename to Poker Hand Prediction/Notebooks/Random Forest.ipynb diff --git a/Poker Hand Prediction/Poker Hand Prediction/Regression.ipynb b/Poker Hand Prediction/Notebooks/Regression.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/Regression.ipynb rename to Poker Hand Prediction/Notebooks/Regression.ipynb diff --git a/Poker Hand Prediction/Poker Hand Prediction/SVM.ipynb b/Poker Hand Prediction/Notebooks/SVM.ipynb similarity index 100% rename from Poker Hand Prediction/Poker Hand Prediction/SVM.ipynb rename to Poker Hand Prediction/Notebooks/SVM.ipynb diff --git a/Poker Hand Prediction/README.md b/Poker Hand Prediction/README.md index f2283c273..0ffd707bd 100644 --- a/Poker Hand Prediction/README.md +++ b/Poker Hand Prediction/README.md @@ -1,47 +1,52 @@ -# Poker Hand Prediction +## **Poker Hand Prediction** -TL;DR, predicting poker hands. +### ๐ŸŽฏ **Goal** -## The Problem +To predict the most likely poker hand present with at least one of the players in the game, given the sequence of 5 'community' cards drawn from a standard deck. -Given the sequence of 5 'community' cards, drawn from a standard deck of cards, what hand is most likely present with at least one of the players in the game. +### ๐Ÿงต **Dataset** -## Poker Hands +The dataset is acquired from UCI's Machine Learning repository. Find it [here](https://archive.ics.uci.edu/ml/datasets/Poker+Hand). -Texas Hold Em is played by dealing each player 2 cards (face down), called the `hole` cards, and dealing 5 `community` cards (face up), on the table. +### ๐Ÿงพ **Description** -The player makes a poker `hand` using any combination of the 3 cards dealt to them, and the 5 cards on the table. +Texas Hold 'Em is played by dealing each player 2 'hole' cards (face down) and 5 'community' cards (face up) on the table. The player makes a poker hand using any combination of the 2 cards dealt to them and the 5 cards on the table. The objective is to predict the rank of the poker hand that is most likely to be present among the players, given the 5 community cards. -The player with the strongest hands wins. Most commonly accepted ranking of hands, strongest to weekest : +### ๐Ÿงฎ **What I had done!** -| Rank | Hand | Description | -| :--: | :--: | :---------: | -| 0 | Royal Flush | `A K Q J 10` all of the same suit | -| 1 | Straight Flush | Any 5 cards of the same suit, in sequence | -| 2 | Four of a Kind | 4 cards of the same rank, like, `4 4 4 4` | -| 3 | Full House | A 3 of a kind, and a pair, of different ranks | -| 4 | Flush | Any 5 cards of the same suit | -| 5 | Straight | Any 5 cards in sequence | -| 6 | Three of a Kind | Any 3 cards of the same rank | -| 7 | Two Pair | Any 2 pairs of cards | -| 8 | One Pair | Any 2 cards of the same rank | -| 9 | High Card | Highest Ranked card in hand | +1. **Data Acquisition**: Downloaded the dataset from UCI's Machine Learning repository. +2. **Data Preprocessing**: Cleaned and prepared the data for analysis. +3. **Model Selection**: Implemented various machine learning models to predict poker hands. +4. **Model Training**: Trained the models on the training dataset. +5. **Model Evaluation**: Evaluated the models on the testing dataset. +6. **Performance Comparison**: Compared the accuracy of different models to determine the best one. +### ๐Ÿš€ **Models Implemented** -#### Ranking of Cards +1. **Linear Regression**: Basic model to establish a baseline. +2. **Support Vector Machine (SVM)**: Chosen for its effectiveness in classification tasks. +3. **Adaboost**: Implemented to improve model performance through boosting. +4. **Output Code Classifier**: Used for multiclass classification. +5. **Random Forest**: Chosen for its robustness and ensemble learning capabilities. +6. **Artificial Neural Network (ANN)**: Implemented for its potential in capturing complex patterns. +7. **Deep Neural Network (DNN)**: Used for its ability to learn from large datasets. +8. **Multi-Layer Perceptron (MLP)**: Chosen for its superior performance in the dataset. -A K Q J 10 9 8 7 6 5 4 3 2 1 +### ๐Ÿ“š **Libraries Needed** -## Data +- numpy +- pandas +- scikit-learn +- tensorflow +- matplotlib +- seaborn -This data was acquired from UCI's Machine Learning repository. The data comes already split into training and testing data. +### ๐Ÿ“Š **Exploratory Data Analysis Results** -Find it [here](https://archive.ics.uci.edu/ml/datasets/Poker+Hand). +![EDA Result 1](https://github.com/aviralgarg05/ML-Crate/blob/main/Poker%20Hand%20Prediction/Images/ANN.png) +![EDA Result 2](https://github.com/aviralgarg05/ML-Crate/blob/main/Poker%20Hand%20Prediction/Images/DNN.png) - -##### NOTE: The hands' class labels are in the reverse order of their strength, i.e, 0 is the weakest hand. - -## Machine Learning ๐Ÿ–ฅ +### ๐Ÿ“ˆ **Performance of the Models based on the Accuracy Scores** | Model | Accuracy | | :---: | :------: | @@ -52,9 +57,14 @@ Find it [here](https://archive.ics.uci.edu/ml/datasets/Poker+Hand). | Random Forest | 56% | | Artificial Neural Network | 45% | | Deep Neural Network | 87% | -| Multi Layer Perceptron | 97% | +| Multi-Layer Perceptron | 97% | + +### ๐Ÿ“ข **Conclusion** + +The Multi-layer Perceptron (MLP) is clearly the best model for the dataset in hand, achieving an accuracy of 97%. This indicates that MLP is highly effective in predicting the poker hands given the community cards. -## Conclusion +### โœ’๏ธ **Your Signature** -The Multi-layer Perceptron is clearly the best model for the dataset in hand. +**Aviral Garg** +[LinkedIn](https://www.linkedin.com/in/aviral-garg-b7b053280/) \ No newline at end of file