GithubHelp home page GithubHelp logo

wujinming / surprise Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nicolashug/surprise

0.0 2.0 0.0 5.93 MB

A Python scikit for building and analyzing recommender systems

Home Page: http://surpriselib.com

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

surprise's Introduction

GitHub version Documentation Status Build Status python versions License

Surprise

Overview

Surprise is a Python scikit building and analyzing recommender systems.

Surprise was designed with the following purposes in mind:

The name SurPRISE (roughly :) ) stands for Simple Python RecommendatIon System Engine.

Getting started, 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)! You'll find more usage examples in the documentation .

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.

Movielens 100k RMSE MAE Time (s)
NormalPredictor 1.5228 1.2242 4
BaselineOnly .9445 .7488 5
KNNBasic .9789 .7732 27
KNNWithMeans .9514 .7500 30
KNNBaseline .9306 .7334 44
SVD .9396 .7412 46
SVD++ .9200 .7253 31min
NMF .9634 .7572 55
Slope One .9454 .7430 25
Co clustering .9678 .7579 15
Movielens 1M RMSE MAE Time (min)
NormalPredictor 1.5037 1.2051 < 1
BaselineOnly .9086 .7194 < 1
KNNBasic .9207 .7250 22
KNNWithMeans .9292 .7386 22
KNNBaseline .8949 .7063 44
SVD .8936 .7057 7
NMF .9155 .7232 9
Slope One .9065 .7144 8
Co clustering .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

License

This project is licensed under the BSD 3-Clause license, so it can be used for pretty much everything, including commercial applications. Please let us know how Surprise is useful to you!

Acknowledgements:

Contributing, feedback, contact

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!

To contact us, send us a tweet or mail us at contact at nicolas-hug dot com. For any bug or issue, please use the GitHub project page.

surprise's People

Contributors

nicolashug avatar pfgimenez avatar naturale0 avatar mahermalaeb avatar

Watchers

James Cloos avatar wujinming avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.