Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
6affea4
transformer base and sasrec config
Jan 22, 2025
3fd3217
tests work linters not
Jan 22, 2025
976c14a
all work
Jan 22, 2025
903b27f
default params
Jan 22, 2025
7b18f5f
removed caching item embeddings
Jan 23, 2025
c5f04e1
configs correct with new args
Jan 23, 2025
1b8a2ad
Merge remote-tracking branch 'origin' into feature/sasrec_configs
Jan 24, 2025
fca4ac0
calc custom loss
Jan 24, 2025
df99299
Merge branch 'experimental/sasrec' into feature/sasrec_configs
blondered Jan 24, 2025
a62e535
fixed and added get_val_mask_func
Jan 24, 2025
2ff5fde
linter
Jan 27, 2025
44be2d6
pyling
Jan 27, 2025
a1b1566
fixed
Jan 27, 2025
6001886
Merge branch 'experimental/sasrec' of https://github.com/MobileTeleSy…
Jan 27, 2025
6724825
updated configs example
Jan 27, 2025
f22a5b5
added custom validation func to config tests
Jan 27, 2025
a7546d7
linters
Jan 27, 2025
268a91a
removed TODO
Jan 27, 2025
a605632
compat and serialization tests
Jan 27, 2025
5820611
fixed example
Jan 28, 2025
d6fa3b2
fixed configs
Jan 28, 2025
91df626
updated tests
Jan 28, 2025
1ea36d8
copyright
Jan 28, 2025
871cb09
fixed accelerator test
Jan 28, 2025
aadadda
fixed tests
Jan 28, 2025
8e7cade
moved _from_config to transformer base
Jan 28, 2025
908eb6d
simplified _get_config
Jan 28, 2025
79aa1b0
added dataset schema
Jan 28, 2025
7ff11c4
sasrec fitted test added
Jan 28, 2025
9395bfc
working fitted save
Jan 28, 2025
1d3f4fd
common tests
Jan 28, 2025
df25d35
Merge branch 'experimental/sasrec' of https://github.com/MobileTeleSy…
Jan 28, 2025
bcf82b5
small fixes
Jan 28, 2025
e958633
fixed tests and linters
Jan 29, 2025
c4afc3e
fixed tests
Jan 29, 2025
97be595
moved init torch model
Jan 29, 2025
fd48927
fixed lighning hooks
Jan 29, 2025
dc0e542
improved user guide
Jan 29, 2025
324909a
train/loss
Jan 29, 2025
933300b
linters and user guide
Jan 29, 2025
2e49647
Merge branch 'experimental/sasrec' of https://github.com/MobileTeleSy…
Jan 29, 2025
9841e0b
fixed tests
Jan 29, 2025
6fc9ec9
updated advanced guide
blondered Jan 29, 2025
e6891c6
moved logs test
blondered Jan 29, 2025
08c0d42
1 device in bert tests
blondered Jan 29, 2025
72dc341
1 device in sasrec tests
blondered Jan 29, 2025
f1807ee
hashable
blondered Jan 29, 2025
cf52792
1 device in transfofmer base test
blondered Jan 29, 2025
1dc533b
skip multi-device tests
blondered Jan 30, 2025
780af0a
small fixes
blondered Jan 30, 2025
66eea1b
returned multi-device test for sasrec
blondered Jan 30, 2025
20b322b
from config
blondered Jan 30, 2025
de961b8
fitted ckpt
blondered Jan 30, 2025
0fac921
removed trainer None
blondered Jan 30, 2025
75e33cd
updated checkpoint behavior
blondered Jan 30, 2025
0f8eb7b
_model_from_checkpoint
blondered Jan 30, 2025
f1728c3
pylint
blondered Jan 30, 2025
3a07c02
simple types and ignore
blondered Jan 30, 2025
c835324
io
blondered Jan 30, 2025
1731209
renamings and get_trainer
blondered Jan 30, 2025
0f714a8
get_trainer_func
blondered Jan 30, 2025
779220b
returned series in mask
blondered Jan 30, 2025
e6b5bca
optional fit_trainer
blondered Jan 30, 2025
a7a6713
fixed docs and tests
blondered Jan 30, 2025
b983c44
updated guide
blondered Jan 30, 2025
aab9df7
docs defaults
blondered Jan 30, 2025
de13e6d
docs
blondered Jan 30, 2025
481c6a5
fixed TODO
blondered Jan 30, 2025
d3e3742
updated readme
blondered Jan 30, 2025
417cee5
readme highlights
blondered Jan 30, 2025
721dd5b
copyright
blondered Jan 30, 2025
2852b53
fixed link
blondered Jan 30, 2025
b8ff6cc
fixed headers
blondered Jan 30, 2025
5cae649
small guide fixes
blondered Jan 30, 2025
6a52df0
io back
blondered Jan 30, 2025
c27af8e
init docs and multi-gpu
blondered Jan 31, 2025
3d0f372
multi gpu readme
blondered Jan 31, 2025
2541c76
entity schema
blondered Jan 31, 2025
7650bf8
fixed schemas and docs
blondered Jan 31, 2025
eb37e8e
fixed dict
blondered Jan 31, 2025
ae40d18
order
blondered Jan 31, 2025
7b23a2a
get items vector tensor
blondered Jan 31, 2025
2b1b752
small fix
blondered Jan 31, 2025
1cf60b7
featurename type
blondered Jan 31, 2025
54555b2
docs and small refactor
blondered Jan 31, 2025
87d0e7a
pr fixes
blondered Feb 3, 2025
acd47c0
Moved external ids out from dataset schema (#254)
feldlime Feb 3, 2025
17781b4
Improved feature schema structure (#255)
feldlime Feb 4, 2025
9dbb668
fixed serialize
blondered Feb 4, 2025
b48e5dd
fixed type error
blondered Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@
<a href="https://github.com/orgs/MobileTeleSystems/projects/1">Developers Board</a>
</p>

RecTools is an easy-to-use Python library which makes the process of building recommendation systems easier,
faster and more structured than ever before.
It includes built-in toolkits for data processing and metrics calculation,
a variety of recommender models, some wrappers for already existing implementations of popular algorithms
and model selection framework.
The aim is to collect ready-to-use solutions and best practices in one place to make processes
of creating your first MVP and deploying model to production as fast and easy as possible.
RecTools is an easy-to-use Python library which makes the process of building recommender systems easier and
faster than ever before.

## ✨ Highlights: Transformer models released! ✨

**BERT4Rec and SASRec are now available in RecTools:**
- Fully compatible with our `fit` / `recommend` paradigm and require NO special data processing
- Explicitly described in our [Transformers Theory & Practice Tutorial](examples/tutorials/transformers_tutorial.ipynb): loss options, item embedding options, category features utilization and more!
- Configurable, customizable, callback-friendly, checkpoints-included, logs-out-of-the-box, custom-validation-ready, multi-gpu-compatible! See our [Transformers Advanced Training User Guide](examples/tutorials/transformers_advanced_training_guide.ipynb)
- We are running benchmarks with comparison of RecTools models to other open-source implementations following BERT4Rec reproducibility paper and achieve highest scores on multiple datasets: [Performance on public transformers benchmarks](https://github.com/blondered/bert4rec_repro?tab=readme-ov-file#rectools-transformers-benchmark-results)






Expand Down Expand Up @@ -103,6 +109,8 @@ See [recommender baselines extended tutorial](https://github.com/MobileTeleSyste

| Model | Type | Description (🎏 for user/item features, 🔆 for warm inference, ❄️ for cold inference support) | Tutorials & Benchmarks |
|----|----|---------|--------|
| SASRec | Neural Network | `rectools.models.SASRecModel` - Transformer-based sequential model with unidirectional attention mechanism and "Shifted Sequence" training objective <br>🎏| 📕 [Transformers Theory & Practice](examples/tutorials/transformers_tutorial.ipynb)<br> 📗 [Transformers advanced training](examples/tutorials/transformers_advanced_training_guide.ipynb) <br> 🚀 [Top performance on public benchmarks](https://github.com/blondered/bert4rec_repro?tab=readme-ov-file#rectools-transformers-benchmark-results) |
| BERT4Rec | Neural Network | `rectools.models.BERT4RecModel` - Transformer-based sequential model with bidirectional attention mechanism and "MLM" (masked item) training objective <br>🎏| 📕 [Transformers Theory & Practice](examples/tutorials/transformers_tutorial.ipynb)<br> 📗 [Transformers advanced training](examples/tutorials/transformers_advanced_training_guide.ipynb) <br> 🚀 [Top performance on public benchmarks](https://github.com/blondered/bert4rec_repro?tab=readme-ov-file#rectools-transformers-benchmark-results) |
| [implicit](https://github.com/benfred/implicit) ALS Wrapper | Matrix Factorization | `rectools.models.ImplicitALSWrapperModel` - Alternating Least Squares Matrix Factorizattion algorithm for implicit feedback. <br>🎏| 📙 [Theory & Practice](https://rectools.readthedocs.io/en/latest/examples/tutorials/baselines_extended_tutorial.html#Implicit-ALS)<br> 🚀 [50% boost to metrics with user & item features](examples/5_benchmark_iALS_with_features.ipynb) |
| [implicit](https://github.com/benfred/implicit) BPR-MF Wrapper | Matrix Factorization | `rectools.models.ImplicitBPRWrapperModel` - Bayesian Personalized Ranking Matrix Factorization algorithm. | 📙 [Theory & Practice](https://rectools.readthedocs.io/en/latest/examples/tutorials/baselines_extended_tutorial.html#Bayesian-Personalized-Ranking-Matrix-Factorization-(BPR-MF)) |
| [implicit](https://github.com/benfred/implicit) ItemKNN Wrapper | Nearest Neighbours | `rectools.models.ImplicitItemKNNWrapperModel` - Algorithm that calculates item-item similarity matrix using distances between item vectors in user-item interactions matrix | 📙 [Theory & Practice](https://rectools.readthedocs.io/en/latest/examples/tutorials/baselines_extended_tutorial.html#ItemKNN) |
Expand All @@ -115,20 +123,33 @@ See [recommender baselines extended tutorial](https://github.com/MobileTeleSyste
| Random | Heuristic | `rectools.models.RandomModel` - Simple random algorithm useful to benchmark Novelty, Coverage, etc.<br>❄️| - |

- All of the models follow the same interface. **No exceptions**
- No need for manual creation of sparse matrixes or mapping ids. Preparing data for models is as simple as `dataset = Dataset.construct(interactions_df)`
- No need for manual creation of sparse matrixes, torch dataloaders or mapping ids. Preparing data for models is as simple as `dataset = Dataset.construct(interactions_df)`
- Fitting any model is as simple as `model.fit(dataset)`
- For getting recommendations `filter_viewed` and `items_to_recommend` options are available
- For item-to-item recommendations use `recommend_to_items` method
- For feeding user/item features to model just specify dataframes when constructing `Dataset`. [Check our tutorial](examples/4_dataset_with_features.ipynb)
- For feeding user/item features to model just specify dataframes when constructing `Dataset`. [Check our example](examples/4_dataset_with_features.ipynb)
- For warm / cold inference just provide all required ids in `users` or `target_items` parameters of `recommend` or `recommend_to_items` methods and make sure you have features in the dataset for warm users/items. **Nothing else is needed, everything works out of the box.**
- Our models can be initialized from configs and have useful methods like `get_config`, `get_params`, `save`, `load`. Common functions `model_from_config` and `load_model` are available. [Check our example](examples/9_model_configs_and_saving.ipynb)


## Extended validation tools

### `calc_metrics` for classification, ranking, "beyond-accuracy", DQ, popularity bias and between-model metrics


[User guide](https://github.com/MobileTeleSystems/RecTools/blob/main/examples/3_metrics.ipynb) | [Documentation](https://rectools.readthedocs.io/en/stable/features.html#metrics)


### `DebiasConfig` for debiased metrics calculation

[User guide](https://github.com/MobileTeleSystems/RecTools/blob/main/examples/8_debiased_metrics.ipynb) | [Documentation](https://rectools.readthedocs.io/en/stable/api/rectools.metrics.debias.DebiasConfig.html)

### `cross_validate` for model metrics comparison


[User guide](https://github.com/MobileTeleSystems/RecTools/blob/main/examples/2_cross_validation.ipynb)


### `VisualApp` for model recommendations comparison

<img src="https://recsysart.ru/images/visual_app.gif" width=500>
Expand Down
2 changes: 2 additions & 0 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ See examples here: https://github.com/MobileTeleSystems/RecTools/tree/main/examp
examples/5_benchmark_iALS_with_features
examples/6_benchmark_lightfm_inference
examples/7_visualization
examples/8_debiased_metrics
examples/9_model_configs_and_saving
6 changes: 6 additions & 0 deletions docs/source/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ Details of RecTools Models
+-----------------------------+-------------------+---------------------+---------------------+
| Model | Supports features | Recommends for warm | Recommends for cold |
+=============================+===================+=====================+=====================+
| SASRecModel | Yes | No | No |
+-----------------------------+-------------------+---------------------+---------------------+
| BERT4RecModel | Yes | No | No |
+-----------------------------+-------------------+---------------------+---------------------+
| DSSMModel | Yes | Yes | No |
+-----------------------------+-------------------+---------------------+---------------------+
| EASEModel | No | No | No |
+-----------------------------+-------------------+---------------------+---------------------+
| ImplicitALSWrapperModel | Yes | No | No |
+-----------------------------+-------------------+---------------------+---------------------+
| ImplicitBPRWrapperModel | No | No | No |
+-----------------------------+-------------------+---------------------+---------------------+
| ImplicitItemKNNWrapperModel | No | No | No |
+-----------------------------+-------------------+---------------------+---------------------+
| LightFMWrapperModel | Yes | Yes | Yes |
Expand Down
2 changes: 2 additions & 0 deletions docs/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ See tutorials here: https://github.com/MobileTeleSystems/RecTools/tree/main/exam
:glob:

examples/tutorials/baselines_extended_tutorial
examples/tutorials/transformers_tutorial
examples/tutorials/transformers_advanced_training_guide
Loading