Giter Club home page Giter Club logo

dota2_death_prediction's Introduction

This repository contains code used for creating a model to predict which hero will die in the near future in a DOTA 2 match. The input of the model is a large number of features (2800+): for example the position, health, mana of the heroes, the cooldowns on their abilities and items, the health of the towers, etc. The output of the model is a probability estimate of each player dying in the next 5 seconds.

The model is described in the paper: Adam Katona, Ryan Spick, Victoria Hodge, Simon Demediuk, Florian Block, Anders Drachen and James Alfred Walker Time to Die: Death Prediction in Dota 2 using Deep Learning, (accepted) IEEE Conference on Games (CoG) 2019 https://arxiv.org/abs/1906.03939

@article{katona2019time,
  title={Time to Die: Death Prediction in Dota 2 using Deep Learning},
  author={Katona, Adam and Spick, Ryan and Hodge, Victoria and Demediuk, Simon and Block, Florian and Drachen, Anders and Walker, James Alfred},
  journal={arXiv preprint arXiv:1906.03939},
  year={2019}
}

The repository contains:

  • The Parser (java program using the clarity parser)
  • Parse scripts and job files (SLURM job)
  • Preproces scripts (python scripts transfroming raw data to a dataset suitable for machine learning)
  • Model and train scripts (PyTorch model and training scripts)

Warning: this is research code, it is not written for reuse. There are hardcoded paths, some unused code...

The Parser:

The purpuse of this program is to take a replay file, and save a timeseries of a set of attributes. input:

  • dem file, Binary format used to store replays for DOTA 2 outputs:
  • attribute csv: first row is the name of the attributes, the rest are datapoints
  • life state csv: life state is recorded at full resolution, so it is in a different file.

Credit: The parser is built upon clarity: https://github.com/skadistats/clarity Some of the code is taken from open dota: https://github.com/odota/parser/blob/master/src/main/java/opendota/Parse.java

Usage: mvn -P my_processor package //(this should download dependencies like clarity) java -jar target/my_processor.one-jar.jar /path/to/demfile /path/to/output_folder

Parse scripts: cluster_scripts/ These files call the parser and the preprocessor on the whole dataset. testing_parse_whole_match.py Parse a whole match for testing.

The Preprocess scripts

  • preprocess.py
    Contains read_and_preprocess_data(game_name,sample=True) function. Takes a csv file of game object attribute timeseries, and outputs a pandas table with a time series of features and labels. Sampling: Since the data is not balanced (there are much more timesteps when noone is dying than someone is dying) we downsample negative examples. To save memory some features are added at a post process step (for example the one hot encoded hero ID) The post processing takes place after we loaded a batch of data (for training or predicting)

  • data_loader.py Contains functions: To normalize the data To load the data (mini batch) To select a subset of features

Model and train scripts:

model.py Contains the pytorch model class. The model is a feed-forward neural network with weight sharing between the features of the 10 heroes. train.py Contains train loop and plotting code. train_scripts/run_experiment.py Code for hyperparameter search (random search)

test_model.py Code to predict and plot whole match predict_on_testset.py Predict on the whole test set, and save predictions to files

test_score.ipynb Analyses predictions analyze_results.ipynb Analyse the results of the hyperparameter search

dota2_death_prediction's People

Contributors

adam-katona avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dota2_death_prediction's Issues

heros.json and Hero_Role_Data_Uptodate.csv

In preprocess.py the files heros.json and Hero_Role_Data_Uptodate.csv are referenced:
#JSON_PATH = '/users/ak1774/scratch/esport/death_prediction/heros.json' #HERO_ROLE_CSV_PATH = "/users/ak1774/scratch/esport/death_prediction/Hero_Role_Data_Uptodate.csv"

However, I wasn't able to find these files in the repository.
Are these files accessible anywhere or do they have to be generated somehow?

dataset

Is there an archive of the dataset?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.