Compresso Recsys
compresso-recsys is the recommender-system companion package for
Compresso. It provides dataset
loaders, checkpoint builders, checkpoint read/write helpers, and retrieval
metrics for sparse representation learning experiments.
The package distribution name is compresso-recsys; the Python import is:
import compresso_recsys as cr
Install
Install from PyPI:
pip install compresso-recsys
Install optional dataset export support:
pip install "compresso-recsys[datasets]"
Install the optional scikit-learn dependency for KNN models:
pip install "compresso-recsys[knn]"
For local development:
pip install -e ../compresso
pip install -e ".[dev,datasets,test]"
Quickstart
Build a MovieLens 1M checkpoint from Python:
import compresso_recsys as cr
checkpoint_path = cr.build_recsys_checkpoint(
dataset="ml1m",
checkpoint_path="artifacts/ml1m/exp001.zip",
annotation_source="genres",
)
with cr.read_checkpoint(checkpoint_path) as root:
split = cr.load_recsys_split(root)
print(split["x_train"].shape)
Build the same kind of checkpoint from the command line:
compresso-recsys-build-checkpoint \
--dataset ml1m \
--checkpoint_path artifacts/ml1m/exp001.zip \
--annotation_source genres
Amazon Reviews 2023 checkpoints can use item metadata for cold-item retrieval experiments:
compresso-recsys-build-checkpoint \
--dataset amazon2023 \
--amazon_category Toys_and_Games \
--checkpoint_path artifacts/amazon_toys/temporal_exp001.zip \
--split_mode temporal \
--temporal_period_hours 8136 \
--metadata_text_fields title,features,description,categories \
--min_entity_text_words 30 \
--annotation_source none
Temporal checkpoints use expanding histories and cumulative mixed warm/cold
catalogs. Their train, validation, and test matrices are aligned by the
corresponding train_item_ids, val_item_ids, and test_item_ids arrays.
What Is Included
Steam supports game metadata for item cold-start and review dates for sequential and temporal checkpoints:
checkpoint_path = cr.build_recsys_checkpoint(
dataset="steam",
split_mode="leave_last_out", # Or "item_split" / "temporal".
checkpoint_path="artifacts/steam/llo.zip",
)
The first run downloads about 1.2 GB of reviews plus game metadata; later runs reuse the local archive and parsed cache. See the dataset guide for metadata, feature availability, cold-start examples, and defaults.
- Dataset utilities for GoodBooks, MovieLens 1M, MovieLens 20M, Amazon Reviews 2023, Steam, Netflix Prize, MSD Taste Profile, Gowalla, DBbook, and Last.fm-2K.
- Optional pretrained multimodal features for ML-1M, DBbook, and Last.fm-2K, stored with item IDs, availability masks, and encoder provenance. See the dataset guide. Other datasets can use the same feature format for user-computed embeddings, including Amazon text/images.
- ZIP checkpoint format for source/target splits, embeddings, sparse embeddings, metrics, and Compresso cluster-graph stages.
- Calibrated Recall and nDCG defaults, with optional standard Recall, Precision, Hit Rate, MRR, and MAP at configurable cutoffs.
- Batched EASE, ADMM and gradient-trained TEASER cold-start models, a content-similarity cold-start baseline, dense ELSA, and lottery-ticket compressed ELSA with streaming evaluation.
- Random and popularity baselines, normalized user-user and item-item cosine
KNN, and multinomial denoising and variational autoencoders (
MultDAEandMultVAE). - Sequential recommenders over chronological histories:
SimpleRNN, a recurrent next-item baseline;SimpleGPT, a causal transformer with a tied head;SASRec, a modernized variant of the published self-attentive architecture trained against sampled negatives; andSimpleBidirectionalTransformer, a sequence-to-set encoder that can train on the target matrices produced by temporal splits. They are built from replaceable parts — anItemTokenizerowning the vocabulary and aSequenceBatcherowning the context window — so bringing your own vocabulary or context length does not mean forking a trainer. - One evaluation path for both model shapes. A sequential and a matrix model are
compared through the same
evaluate_recommenderandcompare_modelscalls, because a recommender is anything implementingpredict_on_batch. - One production recommendation path through
model.recommend(histories, k=...). Histories and optional allow/block filters use stable item IDs; ranked item IDs and scores come back in a batch-shapedRecommendationsresult. Rows with fewer thankvalid candidates truncate without weakening the filters. - Unified fitted-model persistence through
model.save(path)andModelClass.load(path), using versioned ZIP archives that carry model state, configuration, and the vocabulary or candidate catalog needed for serving. - A checkpoint-building console command:
compresso-recsys-build-checkpoint.
Documentation
Release documentation is available at:
https://zombak79.github.io/compresso-recsys/
The full CLI parameter table, checkpoint split schema, and supported Amazon Reviews 2023 categories are maintained in the Checkpoint CLI Reference. Academic references and copy-ready BibTeX for EASE, TEASER, ELSA, large-scale ELSA, compressed ELSA, neighborhood models, Mult-DAE, and Mult-VAE are available in the citation guide. The implementing a recommender tutorial builds a complete Top Popular model with validation, stable-ID recommendation, persistence, evaluation, and executable contract checks.
Build the docs locally:
pip install -e ".[docs]"
sphinx-build -b html docs/source docs/build/html
License
Apache License 2.0. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file compresso_recsys-0.3.4.tar.gz.
File metadata
- Download URL: compresso_recsys-0.3.4.tar.gz
- Upload date:
- Size: 362.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d157a8d6dbe06b2539bca95b2331b96541a8970e07b1a619689e284dea0efcd
|
|
| MD5 |
1996180d9fc3a6a646400c3e19a3c26a
|
|
| BLAKE2b-256 |
b753d1f8d2da754ea69120ad697ef1c5f299ff6673a8b4bf0135086223b5ac27
|
Provenance
The following attestation bundles were made for compresso_recsys-0.3.4.tar.gz:
Publisher:
publish.yml on zombak79/compresso-recsys
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compresso_recsys-0.3.4.tar.gz -
Subject digest:
7d157a8d6dbe06b2539bca95b2331b96541a8970e07b1a619689e284dea0efcd - Sigstore transparency entry: 2795085586
- Sigstore integration time:
-
Permalink:
zombak79/compresso-recsys@77f3e605e40d1ecb6a6a29fb8e5214b6e6642826 -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/zombak79
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@77f3e605e40d1ecb6a6a29fb8e5214b6e6642826 -
Trigger Event:
push
-
Statement type:
File details
Details for the file compresso_recsys-0.3.4-py3-none-any.whl.
File metadata
- Download URL: compresso_recsys-0.3.4-py3-none-any.whl
- Upload date:
- Size: 244.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d55b1be3d24d27ec024de39a4cdd034ffbcdfeae583e12aa5c4f7cd440b990cc
|
|
| MD5 |
5f84975146f39e6245a350f3750476f0
|
|
| BLAKE2b-256 |
8f583b8e6db60d3b66dbbfe9c783ab0afcd70d1baa06c29611d41c9e517a850a
|
Provenance
The following attestation bundles were made for compresso_recsys-0.3.4-py3-none-any.whl:
Publisher:
publish.yml on zombak79/compresso-recsys
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compresso_recsys-0.3.4-py3-none-any.whl -
Subject digest:
d55b1be3d24d27ec024de39a4cdd034ffbcdfeae583e12aa5c4f7cd440b990cc - Sigstore transparency entry: 2795085655
- Sigstore integration time:
-
Permalink:
zombak79/compresso-recsys@77f3e605e40d1ecb6a6a29fb8e5214b6e6642826 -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/zombak79
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@77f3e605e40d1ecb6a6a29fb8e5214b6e6642826 -
Trigger Event:
push
-
Statement type: