Practical overview
When it fits
Use Pecos when building a custom learning or retrieval pipeline where the number of possible outputs is very large and a ranked subset of relevant results is needed.
Who it is for
- Machine-learning developers working with very large label or output sets.
- Teams building ranking, classification or retrieval workflows that need to return a small set of relevant results from a large candidate pool.
Documented uses
- Train an extreme multi-label ranking model using features, labels and a hierarchical label structure.
- Generate and rank relevant labels for input instances.
- Evaluate predictions with precision and recall metrics.
- Use approximate nearest-neighbor search with sparse or dense features.
Requirements & limits
Pecos is open source under the Apache-2.0 license. The README documents installation with Python and pip and lists Ubuntu 20.04/22.04 and Amazon Linux 2 as supporting platforms.
- The documented XMR example requires feature and label matrices in SciPy CSR format.
- The project offers distinct approaches: recursive linear models, transformer-based multi-label learning and HNSW approximate-nearest-neighbor search.
- The stated Python versions are 3.9–3.12, with pip 19.3 or later; setup.py contains additional dependencies.
- The documented platform list is Ubuntu 20.04/22.04 and Amazon Linux 2.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Pecos from a wheel
Install the libpecos package in a Python environment.
Before you start
- Python 3.9, 3.10, 3.11 or 3.12
- pip 19.3 or later
- A virtual environment is recommended by the project documentation
Steps
Create and activate a Python virtual environment.
Run the command below.
python3 -m pip install libpecos
Expected outcome
The README documents the pip command for installing Pecos from a wheel.
Guide limitations
- The README lists Ubuntu 20.04 and 22.04 and Amazon Linux 2 as supporting platforms.
- Additional dependencies are listed in the repository's setup.py.
Train and predict with the X-Linear example
Build a hierarchical label structure, train an X-Linear model, and use it for prediction and evaluation.
Before you start
- Pecos installed in a Python environment
- Feature matrix X and label matrix Y in SciPy CSR format
- Evaluation inputs Xt and Yt for the documented prediction and metric example
Steps
Create label features from Y and X with LabelEmbeddingFactory.
Generate a cluster chain with Indexer.gen.
Train an XLinearModel using X, Y and the cluster chain, then save the model.
Predict on Xt and generate metrics with smat_util.Metrics.generate.
Expected outcome
The example produces model predictions and calculates precision and recall at k=10.
Guide limitations
- The README presents this as a toy XMR example; it does not define a complete data-preparation workflow.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- amzn/pecos · Official homepage title · retained in its source language

