Skip to content

Repository files navigation

Predicting Drafted Deck Strength for "Magic: the Gathering"

How to run

Required Preparations

This repo uses pixi to handle dependencies. Install it here, and start a pixi shell with:

pixi shell

(or prefix all commands with pixi run <command>).

To use EmbeddingGemma textual encodings (no alternatives currently available), a HuggingFace token is required, and should be provided in the file tokens.json.

Running an Experiment

An experiment is run with

python experiment.py [ARGS]

The easiest way to launch an experiment is to define one in a yaml fine (with examples in experiments/config), and load the config with:

python experiment.py --conf experiments/config/sameset2.yml -d 2

Using the -d argument to fix the number of GPUs. All the arguments can be listed with -h.

Once an experiment is finished, the results are stored in experiments/results/<name>, and a plot/table can be generated by running:

python plot.py experiments/results/<name>/results.pkl [ARGS]

We recommend using the following arguments for clean plots:

python plot.py experiments/results/<name>/results.pkl --only-test-indicators --mark-lines --skip-batch --smooth-window 1 --average-runs --legend-fontsize 7

Other

Card Selection

Our models only predict the estimated win rate for a given draft. To get actual draft recommendations, a simulated draft can be generated for each potential pick to produce a policy at any point during a draft. eval.py provides utilities to do this for a given pre-trained model, which has to be manually selected by changing path and i_model.

How to add a new set?

Edit data/set_config.json to add the new set following the other existing extensions. It might be necessary to delete data/{cards_mtga.csv,cards_scryfall.json,cards_scryfall.parquet,keywords.json} if the new extension is newer than those files.

About

Predicting Drafted Deck Strength for "Magic: the Gathering"

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages