An easy-to-use library for recommender systems.
Project description
Surprise
Overview
Surprise is a Python scikit building and analysing recommender systems.
Surprise was designed with the following purposes in mind:
Give the user perfect control over his experiments. To this end, a strong emphasis is laid on documentation, which we have tried to make as clear and precise as possible by pointing out every details of the algorithms.
Alleviate the pain of Dataset handling. Users can use both built-in datasets (Movielens, Jester), and their own custom datasets.
Provide various ready-to-use prediction algorithms such as baseline algorithms, neighborhood methods, matrix factorization-based ( SVD, PMF, SVD++, NMF), and many others. Also, various similarity measures (cosine, MSD, pearson…) are built-in.
Make it easy to implement new algorithm ideas.
Provide tools to evaluate, analyse and compare the algorithms performance. Cross-validation procedures can be run very easily, as well as exhaustive search over a set of parameters.
The name SurPRISE (roughly :) ) stands for Simple Python RecommendatIon System Engine.
Example
Here is a simple example showing how you can (down)load a dataset, split it for 3-folds cross-validation, and compute the MAE and RMSE of the SVD algorithm.
from surprise import SVD
from surprise import Dataset
from surprise import evaluate, print_perf
# Load the movielens-100k dataset (download it if needed),
# and split it into 3 folds for cross-validation.
data = Dataset.load_builtin('ml-100k')
data.split(n_folds=3)
# We'll use the famous SVD algorithm.
algo = SVD()
# Evaluate performances of our algorithm on the dataset.
perf = evaluate(algo, data, measures=['RMSE', 'MAE'])
print_perf(perf)
Output:
Evaluating RMSE, MAE of algorithm SVD. Fold 1 Fold 2 Fold 3 Mean MAE 0.7475 0.7447 0.7425 0.7449 RMSE 0.9461 0.9436 0.9425 0.9441
Surprise can do much more (e.g, GridSearch). Check the User Guide!
Benchmarks
Here are the average RMSE, MAE and total execution time of various algorithms (with their default parameters) on a 5-folds cross-validation procedure. The datasets are the Movielens 100k and 1M datasets. The folds are the same for all the algorithms (the random seed is set to 0). All experiments are run on a small laptop with Intel Core i3 1.7 GHz, 4Go RAM. The execution time is the real execution time, as returned by the GNU time command.
RMSE |
MAE |
Time (s) |
|
---|---|---|---|
1.5228 |
1.2242 |
4 |
|
.9445 |
.7488 |
5 |
|
.9789 |
.7732 |
27 |
|
.9514 |
.7500 |
30 |
|
.9306 |
.7334 |
44 |
|
.9396 |
.7412 |
46 |
|
.9200 |
.7253 |
31min |
|
.9634 |
.7572 |
55 |
|
.9454 |
.7430 |
25 |
|
.9678 |
.7579 |
15 |
RMSE |
MAE |
Time (min) |
|
---|---|---|---|
1.5037 |
1.2051 |
< 1 |
|
.9086 |
.7194 |
< 1 |
|
.9207 |
.7250 |
22 |
|
.9292 |
.7386 |
22 |
|
.8949 |
.7063 |
44 |
|
.8936 |
.7057 |
7 |
|
.9155 |
.7232 |
9 |
|
.9065 |
.7144 |
8 |
|
.9155 |
.7174 |
2 |
Installation / Usage
The easiest way is to use pip (you’ll need numpy):
$ pip install numpy $ pip install scikit-surprise
Or you can clone the repo and build the source (you’ll need Cython and numpy):
$ git clone https://github.com/NicolasHug/surprise.git $ python setup.py install
Documentation, Getting Started
The documentation with many other usage examples is available online on ReadTheDocs.
License
This project is licensed under the BSD 3-Clause license.
Acknowledgements:
Pierre-François Gimenez, for his valuable insights on software design.
Maher Malaeb, for the GridSearch implementation.
Contributing, feedback
Any kind of feedback/criticism would be greatly appreciated (software design, documentation, improvement ideas, spelling mistakes, etc…).
If you’d like to see some features or algorithms implemented in Surprise, please let us know! Some of the current ideas are:
Bayesian PMF
RBM for CF
Please feel free to contribute (see guidelines) and send pull requests!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file scikit-surprise-1.0.2.tar.gz
.
File metadata
- Download URL: scikit-surprise-1.0.2.tar.gz
- Upload date:
- Size: 504.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c5a1d8f17381c7d66d7713a37f87f480cc6650fe58ae5de6a9c2b9ae0ba240f |
|
MD5 | cf9928b07b4a405ef36225600078ffb7 |
|
BLAKE2b-256 | 789f45821adeda7e8a56ef2e773b45c370832fdb8772957ed5bf50c6239658b1 |