A machine learning project to predict the difficulty/ranking of chess puzzles using various chess position features and puzzle characteristics.
This project aims to predict chess puzzle difficulty ratings based on puzzle characteristics and chess position analysis. The project uses machine learning techniques, specifically XGBoost regression, to model puzzle difficulty from features extracted from chess positions and puzzle metadata.
Competition: KnowledgePit - Predicting Chess Puzzle Difficulty
For detailed methodology, analysis, and results, refer to report.pdf included in the repository.
- Python 3.7+
- Jupyter Notebook or JupyterLab
- Clone the repository:
git clone https://github.com/adambiel22/predicting-chess-puzzle-difficulty.git
cd predicting-chess-puzzle-difficulty- Install the required packages:
pip install -r requirements.txtThis notebook handles feature engineering from raw chess puzzle data:
- Chess Position Analysis: Extracts features from FEN (Forsyth-Edwards Notation) positions
- Material Evaluation: Calculates material balance and piece values
- Move Analysis: Analyzes puzzle moves and piece interactions
- Strategic Features: Identifies checks, captures, and tactical patterns
This notebook focuses on model development and evaluation:
- Data Preprocessing: Handles categorical variables and data splitting
- Model Training: Uses XGBoost regression to predict puzzle rankings
- Evaluation: Assesses model performance using metrics like MSE and R²
- Visualization: Creates plots for data distribution and model performance analysis
- Feature Importance: Analyzes which features contribute most to predictions
This notebook generates final predictions:
- Model Loading: Loads the trained XGBoost model
- Batch Prediction: Applies the model to test datasets
- Output Generation: Creates submission-ready prediction files