ML
Machine learning modules for analyzing 17lands data.
Model
Machine learning model architectures.
- class mtga_ml.ml.model.PickAdvisor(model, card_names)
Abstract class for advising a pick in a given a draft state.
This class can be used for predicting human picks, recommending a pick that maximizes expected winrate, predicting whether a card will wheel, or predicting whether a card will be maindecked if picked, among other things.
- Parameters
- class mtga_ml.ml.model.PoolPackPickPredictor(model, card_names, not_in_pack_val=- 1000.0)
Class for predicting human picks from the pool and pack of the draft state.
- Parameters
model (nn.Module) – Takes a draft state pool as input and outputs a pick prediction logit for each card in the format.
card_names (list[str]) – A list of the names of all cards in the target format.
not_in_pack_val (float) – Logits for cards not in the pack are set to this value. Should be a large negative number.
- mtga_ml.ml.model.mlp(dims, activation_function, use_batchnorm=False, dropout_rate=0.0)
Multi-layer perceptron.
- Parameters
dims (list[int]) – Number of neurons to use in each hidden layer. The first and last int of dims are the MLP input and output dimensions, respectively.
activation_function (nn.Module) – Non-linear activation function to apply in each layer.
use_batchnorm (bool) – If true, uses batch normalization in each hidden layer.
dropout_rate (float) – If not zero, uses dropout with the specified rate.
- Returns
MLP model as an nn.Module.
Examples
>>> # Deck classifier. `num_cards` is the number of cards in the target format. >>> h_dims = [50, 50] >>> model = mlp([num_cards] + h_dims + [1], nn.ReLU())