A scikit-style recommender systems library
Project description
scikit-rec
A composable, scikit-style recommender systems library.
scikit-rec provides a 3-layer architecture that cleanly separates business logic, scoring strategy, and ML models. Any recommender works with any compatible scorer and estimator, giving you a mix-and-match toolkit for building recommendation systems.
Recommender (business logic) --> Scorer (item scoring) --> Estimator (ML model)
Installation
pip install scikit-rec
Optional extras:
pip install scikit-rec[torch] # Deep learning models (DeepFM, NCF, SASRec, HRNN, Two-Tower)
pip install scikit-rec[aws] # S3 data loading
Quick Start
from skrec.estimator.classification.xgb_classifier import XGBClassifierEstimator
from skrec.scorer.universal import UniversalScorer
from skrec.recommender.ranking.ranking_recommender import RankingRecommender
from skrec.examples.datasets import (
sample_binary_reward_interactions,
sample_binary_reward_users,
sample_binary_reward_items,
)
# Build the pipeline: Estimator -> Scorer -> Recommender
estimator = XGBClassifierEstimator({"learning_rate": 0.1, "max_depth": 5})
scorer = UniversalScorer(estimator)
recommender = RankingRecommender(scorer)
# Train
recommender.train(
interactions_ds=sample_binary_reward_interactions,
users_ds=sample_binary_reward_users,
items_ds=sample_binary_reward_items,
)
# Recommend
interactions_df = sample_binary_reward_interactions.fetch_data()
users_df = sample_binary_reward_users.fetch_data()
recommendations = recommender.recommend(interactions=interactions_df, users=users_df, top_k=5)
Components
Recommenders
| Recommender | Description |
|---|---|
RankingRecommender |
Rank items by predicted score |
ContextualBanditsRecommender |
Exploration-exploitation strategies (epsilon-greedy, static action) |
UpliftRecommender |
Uplift modeling (S-Learner, T-Learner, X-Learner) |
SequentialRecommender |
Sequence-aware recommendations |
HierarchicalSequentialRecommender |
Session-aware hierarchical sequences (HRNN) |
GcslRecommender |
Multi-objective goal-conditioned supervised learning |
Scorers
| Scorer | Description |
|---|---|
UniversalScorer |
Single global model using item features (auto-dispatches tabular vs. embedding) |
IndependentScorer |
Separate model per item |
MulticlassScorer |
Items as competing classes |
MultioutputScorer |
Multiple outcomes per prediction |
SequentialScorer |
For sequential estimators (SASRec) |
HierarchicalScorer |
For HRNN estimators |
Estimators
| Type | Models |
|---|---|
| Tabular | XGBoost, LightGBM, Logistic Regression, sklearn classifiers/regressors |
| Embedding | Matrix Factorization, NCF, Two-Tower, DCN, DeepFM |
| Sequential | SASRec, HRNN |
Evaluators
Offline policy evaluation methods: Simple, IPS, Doubly Robust, SNIPS, Direct Method, Policy Weighted, Replay Match.
Metrics
Precision@k, Recall@k, MAP, MRR, NDCG, ROC-AUC, PR-AUC, Expected Reward.
Retrievers
Two-stage retrieval: Popularity, Content-Based, Embedding-Based.
Documentation
See the docs/ directory for:
- Architecture overview
- Capability matrix
- Quick start tutorial
- Dataset preparation
- Evaluation guide
- Example notebooks
Development
git clone https://github.com/intuit/scikit-rec.git
cd scikit-rec
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/
License
Project details
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 scikit_rec-0.1.4.tar.gz.
File metadata
- Download URL: scikit_rec-0.1.4.tar.gz
- Upload date:
- Size: 48.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ae45011c8022d8a708c7e45c47d29451154b597698a752588ca8dc5f9ec51fb
|
|
| MD5 |
b9355245f19ca08306038d2cb86467a1
|
|
| BLAKE2b-256 |
6c87c5d47b4cd37c0bde305f779f7abede26dbbc501d78b1b0e076fe336159a7
|
Provenance
The following attestation bundles were made for scikit_rec-0.1.4.tar.gz:
Publisher:
publish.yml on intuit/scikit-rec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scikit_rec-0.1.4.tar.gz -
Subject digest:
6ae45011c8022d8a708c7e45c47d29451154b597698a752588ca8dc5f9ec51fb - Sigstore transparency entry: 1325336573
- Sigstore integration time:
-
Permalink:
intuit/scikit-rec@bb5a1260207b5d8a0202f36722aa22faba78fbfc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intuit
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb5a1260207b5d8a0202f36722aa22faba78fbfc -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file scikit_rec-0.1.4-py3-none-any.whl.
File metadata
- Download URL: scikit_rec-0.1.4-py3-none-any.whl
- Upload date:
- Size: 439.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c72278744cbc0c2e9c3c8c84c3e0269fa30e6ca6721450217308a80ada2d0713
|
|
| MD5 |
3ef0c47642f4419526e8e848e9394b97
|
|
| BLAKE2b-256 |
56a50fbd42fb27bd1aaa6e51cdbf4e2448bc49a5b3559746e43499b1e9aec5c3
|
Provenance
The following attestation bundles were made for scikit_rec-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on intuit/scikit-rec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scikit_rec-0.1.4-py3-none-any.whl -
Subject digest:
c72278744cbc0c2e9c3c8c84c3e0269fa30e6ca6721450217308a80ada2d0713 - Sigstore transparency entry: 1325336691
- Sigstore integration time:
-
Permalink:
intuit/scikit-rec@bb5a1260207b5d8a0202f36722aa22faba78fbfc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intuit
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb5a1260207b5d8a0202f36722aa22faba78fbfc -
Trigger Event:
workflow_dispatch
-
Statement type: