checkmate-with-data

A data-driven analysis of my personal chess journey on chess.com

View the Project on GitHub moodymoeed/checkmate-with-data

Checkmate with Data: A Quantitative Analysis of Personal Chess Performance

1. Project Motivation

During the Summer of 2025, I dedicated significant time to playing Rapid Chess on Chess.com. Like many amateur players, I experienced periods of rapid improvement followed by frustrating stagnation. I often relied on intuition to assess my play (“I feel like I play worse at night,” or “I think I’m bad with Black pieces”).

The goal of this project is to replace intuition with evidence. By building a full Data Science pipeline—from API extraction to Statistical Inference—I aim to uncover the hidden patterns in my game history, quantify my weaknesses, and derive actionable insights to reach the next ELO milestone.


2. Data Pipeline & Methodology

2.1 Data Acquisition

2.2 Data Cleaning & Filtering

To ensure statistical validity, the raw data required significant preprocessing:


3. Exploratory Data Analysis (EDA)

3.1 Performance Evolution (Time Series)

Objective: Visualize the progression of ELO rating over time and identify improvement phases.

Rating Trend

Insights:

3.2 The “White Advantage” (Color Analysis)

Objective: Determine if playing White provides a significant competitive edge.

Color Performance

Insights:

3.3 Opening Repertoire Strategy

Objective: Identify the most successful openings and those that need abandonment.

Opening Repertoire

Actionable Takeaways:

  1. The “Center Game” (69% Win Rate): This is my most effective weapon. I should actively steer games toward this structure.
  2. The “Scotch Game” (30% Win Rate): I consistently lose with this opening. It is statistically detrimental to my rating and requires immediate study or abandonment.

3.4 Circadian Rhythms & Fatigue

Objective: Correlate playing volume with win-rate efficiency.

Habit Dashboard

Insights:


4. Statistical Hypothesis Testing

To ensure the findings above weren’t just random variance, I performed formal statistical tests (scipy.stats and statsmodels).

Test 1: The First Move Advantage

Z-Test Visualization

Results:

Test 2: Game Duration Dynamics

Game Duration Boxplot

Results:

Conclusion: Both tests returned $p \approx 0$, leading to a Strong Rejection of the Null Hypothesis.


5. Predictive Modeling (Machine Learning)

The Challenge: Can AI predict if I will win based only on the board state at Move 15?

5.1 Model Comparison

I compared a linear baseline against complex tree-based models using 5-Fold Cross-Validation.

Model Comparison

Conclusion: The simpler model (Logistic Regression) won. This implies that my games are decided by linear, cumulative advantages (Material + Mobility) rather than complex, non-linear positional nuances that tree models look for.

5.2 What Drives a Win?

The Logistic Regression coefficients reveal the “Equation of Victory”:

Coefficients

  1. Material (Coeff > 1.0): The dominant factor. Being up a pawn at Move 15 is the surest predictor of a win.
  2. Mobility: Active pieces matter, but are secondary to raw material.
  3. Scotch Game: This opening has a negative coefficient, statistically confirming it is a liability in my repertoire.

5.3 Deep Dive: Evaluation & Interpretation

To understand how the model predicts, I analyzed the errors using a Confusion Matrix. This reveals the “Human Element” of the games—specifically, where I deviated from statistical expectations.

Confusion Matrix

The “Chess Translation” of Errors

In this specific context, prediction errors have concrete chess meanings:


5.4 Advanced Strategy: Threshold Tuning

By default, the model predicts a Win if probability > 50%. However, I tuned this threshold to 0.20 (maximizing F1-Score) to see what happens when the model becomes “optimistic.”

Metric Standard Model (0.50) Tuned Model (0.20) Chess Interpretation
Accuracy 65% 63% The standard model is more realistic about the overall outcome.
Win Recall 64% 100% The tuned model never misses a winning chance. It catches every single game I eventually won.
Loss Precision 65% 100% Critical Insight: When the tuned model says “Loss”, the position is statistically hopeless. I never recovered from these games.
Blunder Count 13 Games 29 Games The tuned model highlights potential. It flagged 29 games where I had at least a 20% chance to win, but lost.

Conclusion:


6. Interactive Dashboard (Streamlit App)

As a final deliverable, I built an interactive web application to present these findings dynamically. The app features:

App Preview


7. Conclusion & Future Work

This project successfully applied Data Science to analyze chess performance.

  1. Tactics over Strategy: The ML results prove that Material is the primary driver of my results.
  2. Schedule Matters: Avoiding Late Night Friday games could instantly improve my average rating.
  3. Opening Repair: The Scotch Game and King’s Knight Variation are statistical weaknesses that need to be abandoned or restudied.

8. How to Run

  1. Clone the repository:
    git clone https://github.com/moodymoeed/checkmate-with-data.git
    
  2. Create and activate environment:
    python -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
    
  3. Install dependencies:
    pip install -r requirements.txt
    
  4. Run the analysis: Open analysis.ipynb in Jupyter Lab or VS Code and execute cells.
  5. Run the Dashboard App:
    streamlit run app.py
    

    The app will launch in your browser at http://localhost:8501.


This project was conducted for the Sabanci University DSA 210 Course (Fall 2025).