Practical overview
When it fits
Use Magpie when you have labeled text and want to train a model that can predict multiple labels for new documents.
Who it is for
- Researchers and developers labeling abstracts or other document collections.
- Teams building a classifier from their own corpus of labeled text.
Documented uses
- Train a model to assign subject categories or keywords to text.
- Predict scored labels for a text string or a file.
- Train on a dataset too large to fit in memory using batch_train.
Requirements & limits
The repository is public and MIT-licensed. The README says the package is installed directly from GitHub, not PyPI.
- Training requires a large UTF-8 labeled corpus organized into same-named .txt and .lab file pairs.
- Word2Vec representations and a corpus-specific scaler are needed; Magpie can create them or reuse saved components.
- Batch training is available for datasets that do not fit in memory.
- The model consists of Word2Vec mappings, a scaler and a Keras model, which can be saved and reused.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Train a classifier and predict labels
Prepare labeled text, train a Magpie model and obtain scored predictions.
Before you start
- A large corpus of UTF-8 text with matching .txt and .lab files; each pair must share a filename.
- Python and the Magpie package installed from GitHub, with dependency versions as listed in setup.py.
Steps
Initialize word vectors and the corresponding scaler from the corpus with init_word_vectors.
Train with the corpus path, the desired label list and selected training parameters.
Use predict_from_text for a text string or predict_from_file for a document.
Expected outcome
Magpie returns labels with scores for the supplied text or file.
Guide limitations
- The documentation calls for a large labeled corpus.
- If the dataset does not fit in memory, the README recommends batch_train, which has a similar API and is more memory efficient.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 7 November 2026
- Original website title
- inspirehep/magpie · Official homepage title · retained in its source language

