• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deep recommender systems for Rust

sbr

Crates.io badge Docs.rs badge Build Status

An implementation of sequence recommenders based on the wyrm autdifferentiaton library.

sbr-rs

sbr implements efficient recommender algorithms which operate on sequences of items: given previous items a user has interacted with, the model will recommend the items the user is likely to interact with in the future.

Implemented models:

  • LSTM: a model that uses an LSTM network over the sequence of a user's interaction to predict their next action;
  • EWMA: a model that uses a simpler exponentially-weighted average of past actions to predict future interactions.

Which model performs the best will depend on your dataset. The EWMA model is much quicker to fit, and will probably be a good starting point.

Example

You can fit a model on the Movielens 100K dataset in about 10 seconds:

let mut data = sbr::datasets::download_movielens_100k().unwrap();

let mut rng = rand::XorShiftRng::from_seed([42; 16]);

let (train, test) = sbr::data::user_based_split(&mut data, &mut rng, 0.2);
let train_mat = train.to_compressed();
let test_mat = test.to_compressed();

println!("Train: {}, test: {}", train.len(), test.len());

let mut model = sbr::models::lstm::Hyperparameters::new(data.num_items(), 32)
    .embedding_dim(32)
    .learning_rate(0.16)
    .l2_penalty(0.0004)
    .lstm_variant(sbr::models::lstm::LSTMVariant::Normal)
    .loss(sbr::models::Loss::WARP)
    .optimizer(sbr::models::Optimizer::Adagrad)
    .num_epochs(10)
    .rng(rng)
    .build();

let start = Instant::now();
let loss = model.fit(&train_mat).unwrap();
let elapsed = start.elapsed();
let train_mrr = sbr::evaluation::mrr_score(&model, &train_mat).unwrap();
let test_mrr = sbr::evaluation::mrr_score(&model, &test_mat).unwrap();

println!(
    "Train MRR {} at loss {} and test MRR {} (in {:?})",
    train_mrr, loss, test_mrr, elapsed
);

License: MIT

More Repositories

1

spotlight

Deep recommender models using PyTorch.
Python
2,857
star
2

glove-python

Toy Python implementation of http://www-nlp.stanford.edu/projects/glove/
Python
1,232
star
3

rustlearn

Machine learning crate for Rust
Rust
598
star
4

triplet_recommendations_keras

An example of doing MovieLens recommendations using triplet loss in Keras
Jupyter Notebook
417
star
5

wyrm

Autodifferentiation package in Rust.
Rust
169
star
6

sbr-go

Recommender systems for Go
Go
169
star
7

netrex

Neural network recommendation models in PyTorch
Python
57
star
8

recommender_datasets

A common format and repository for various recommender datasets.
Python
38
star
9

mixture

TeX
26
star
10

python-rustlearn

Calling rustlearn from Python
Python
26
star
11

explicit-vs-implicit

An experiment on explicit vs implicit feedback recommenders
Jupyter Notebook
26
star
12

binge

Recommendation models that use binary rather than floating point operations at prediction time.
TeX
21
star
13

fizzbuzz

A FizzBuzz solver using a Rust autodifferentiation library.
Rust
20
star
14

dictionarylearning

Online learning of sparse dictionaries
Java
13
star
15

dynarray

Dynamic Numpy arrays
Python
13
star
16

hugo-blog

Rust
8
star
17

BayesianTestJS

Rudimentary Bayesian Beta-Bernoulli A/B testing inference and visualization code.
JavaScript
6
star
18

BetaJS

Beta distribution probability density function (PDF) for JavaScript
JavaScript
3
star
19

sbr-sys

Rust
2
star
20

spotlight-recipe

Conda recipes for Spotlight
Shell
2
star
21

blas_cython

Python
1
star
22

lightfm_datasets

Datasets for the LightFM package
Python
1
star
23

sketchy

Python
1
star
24

wheedle

Rust
1
star
25

fictional-octo-chainsaw

1
star