Clash Royale Machine Learning Project

Clash Royale Match Prediction

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

  1. Introduction
  2. Methods
  3. Data Representation and Preprocessing
  4. Modeling and Evaluation
  5. Conclusion
  6. Discussion
  7. How to Run the Code
  8. Try the Interface

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:

API

The project integrates the Clash Royale API to fetch real-time player match data, including:

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:

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:

Try the Interface Here!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Go to Dashboard