Predict Magic: The Gathering card rarity.
fetch_sets.py: fetches all core and expansion sets since M10. This can take some time and the service can timeout. There is a-s [set code]argument which starts the download at the given set.preprocess_sets.py: processes all the downloaded sets in the/setsfolder. This normalizes the text in card abilities and removed unwanted card types (lands, planeswalkers, saga enchantments). The output of this process ispreprocessed_sets.csv.build_word2vec.py: Builds and visualizes a word2vec model from dataset.utils.py: Various utilities used in most of the files above. Primary functions are retrieving a train/test data split from a.csvfile, creating the word embedding matrix, and creating confusion matrices.
naive_prediction.py: Uses a simple model from the SKLearn library to predict rarity. Takes the argument-cfor classifier which is one of "mlp" (multi-layer perceptron), "svm" (support vector machine), and "rf" (random forest). Default is "mlp".rnn_model.py: The RNN modelrnn_prediction.py: Trains and tests the RNN model. Arguments:-ssize of embedding (100, 200, or 300)-mmodel variant, one of 'lstm' or 'conv'. Default 'lstm'.-epath for embedding file. Default is 'tmp/embedding_matrix.npy', will be built from 'Glove.6B.200d.txt' if it doesn't exist.-tpath for tokenizer file. Default is 'tmp/default_tokenizer.pickle', will be built with default embedding if it doesn't exist.
rnn_viz.py: Visualizes the output of an RNN model as a confusion matrix. Arguments are same as inrnn_prediction.pyhowever embedding and tokenizer files will not be built if they do not exist.rnn_analysis.py: Visualizes the predictions of an RNN model as a browsable HTML page. Arguments are same as inrnn_prediction.pyhowever embedding and tokenizer files will not be built if they do not exist.