This repository contains the code for a machine learning project focused on building and evaluating various models on a tic-tac-toe dataset. The project involves implementing classifiers and regressors using libraries such as pandas
, numpy
, and scikit-learn
, and demonstrates how these models can be used to predict optimal moves in a tic-tac-toe game.
This project implements several machine learning models to classify and predict outcomes in a tic-tac-toe game. The dataset includes final board states, optimal single moves, and optimal multiple moves. The models are evaluated based on their accuracy and root mean square error (RMSE).
The code is implemented in a Jupyter notebook and includes the following steps:
- Data Import and Processing: Using
pandas
andnumpy
to handle the tic-tac-toe data. - Model Building: Implementing and training the following models:
- Classifiers: Linear SVM, K-Nearest Neighbors (KNN), and Multilayer Perceptron (MLP).
- Regressors: KNN, MLP, and Linear Regression.
- Model Evaluation: Evaluating the models using metrics such as accuracy and RMSE.
- Saving Models: Using the
joblib
library to save the trained regression models for use in a command line tic-tac-toe game.
- MLP:
- Accuracy: 99% (final board state data), 91% (single move data)
- KNN:
- Accuracy: ~100% (final board state data), 86% (single move data)
- SVM:
- Accuracy: 98% (final board state data), 82% (single move data)
- MLP:
- Accuracy: 83%, RMSE: 0.1673
- KNN:
- Accuracy: 69%, RMSE: 0.2838
- Linear Regression:
- Accuracy: 0%, RMSE: 0.464
To run the code, ensure you have Python installed along with the necessary libraries. Follow these steps:
-
Clone this repository:
git clone https://github.com/abdulhakim233/Tic-Tac-Toe.git cd Tic-Tac-Toe
-
Install the required libraries: `` pip install pandas numpy scikit-learn matplotlib
-
Open on the Jupyter notebook or any code editor you want
-
Run the cells in the notebook to train and evaluate the models.
- The multi-output linear regression model currently has an accuracy of zero.
- Due to computational limitations, the number of iterations for the MLP model is restricted, potentially affecting its performance.