Skip to main content

Compresso Recsys

PyPI Python License Docs

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

  • Dataset utilities for GoodBooks, MovieLens 1M, MovieLens 20M, and Amazon Reviews 2023.
  • 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 (MultDAE and MultVAE).
  • 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; and SimpleBidirectionalTransformer, a sequence-to-set encoder that can train on the target matrices produced by temporal splits. They are built from replaceable parts — an ItemTokenizer owning the vocabulary and a SequenceBatcher owning 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_recommender and compare_models calls, because a recommender is anything implementing predict_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-shaped Recommendations result. Rows with fewer than k valid candidates truncate without weakening the filters.
  • Unified fitted-model persistence through model.save(path) and ModelClass.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

compresso_recsys-0.3.3.tar.gz (309.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compresso_recsys-0.3.3-py3-none-any.whl (222.7 kB view details)

Uploaded Python 3

File details

Details for the file compresso_recsys-0.3.3.tar.gz.

File metadata

  • Download URL: compresso_recsys-0.3.3.tar.gz
  • Upload date:
  • Size: 309.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for compresso_recsys-0.3.3.tar.gz
Algorithm Hash digest
SHA256 0cde68edb15801974233af46be00ee19562fd24d2e1c78a9ca7b271201178003
MD5 3e5606e0c46851d60f4301df2e1cbd5a
BLAKE2b-256 d8f904a7ee67016b209b5858ca88ba0cb9f9cab2e644d886f272d17a5c64818a

See more details on using hashes here.

Provenance

The following attestation bundles were made for compresso_recsys-0.3.3.tar.gz:

Publisher: publish.yml on zombak79/compresso-recsys

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compresso_recsys-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for compresso_recsys-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bf78e903f151b617e1b115099ecde73defc2afbd7c0d9ce185c57cc7d01e902a
MD5 3d6d0bccb1337d02a44419b60ef27f89
BLAKE2b-256 a02a1739d5d94e51c505278c5d9c8ff77ad1feb03b2c1048fbf3d6e1105fc339

See more details on using hashes here.

Provenance

The following attestation bundles were made for compresso_recsys-0.3.3-py3-none-any.whl:

Publisher: publish.yml on zombak79/compresso-recsys

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.4

2 files

This release

0.3.3 This release

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page