Welcome to the Clash Royale Match Prediction project! This repository provides tools to fetch, clean, and analyze battle data from the Clash Royale API, with the option to develop predictive models for match outcomes. It's a perfect starting point for Clash Royale enthusiasts looking to delve into data science or machine learning.
Table of Contents
Introduction
This project aims to create a predictive system for Clash Royale, a strategy-based card game with 181 unique cards. Players build eight-card decks, and the synergy, counter-abilities, and balance of the deck significantly impact match outcomes.
The system predicts the probability of winning based on two opponents' decks using historical match data and machine learning models. It provides insights into how card combinations influence match results.
Methods
Historical Dataset
The dataset consists of 2.5 million matches sourced from Hugging Face. It includes:
- Deck Composition: The cards in each player's eight-card deck.
- Match Outcome: Indicates the winner.
API
The project integrates the Clash Royale API to fetch real-time player match data, including:
- Deck composition
- Match outcomes for the last 30 matches
Data Representation and Preprocessing
Deck Representation Using One-Hot Encoding
Each of the 181 cards is represented as a binary vector. A deck is encoded as a single vector of 181 elements, where positions corresponding to the deck's cards are set to `1`, and others are set to `0`.
Outcome Encoding and Dataframe Creation
Match outcomes were encoded as:
- 1: Player 1 wins
- 0: Player 2 wins
Modeling and Evaluation
Models Tested
Neural Network (TensorFlow): Achieved 56.62% accuracy.
XGBoost Classifier: Achieved 84.3% accuracy and an F1-score of 83%.
Try the Interface
Test the interactive Clash Royale prediction system directly on Hugging Face Spaces:
License
This project is licensed under the MIT License. See the LICENSE file for details.