Git Product home page Git Product logo

reco's Introduction

reco

a simple yet versatile recommendation systems library in python

GitHub ReleaseDownloadsMIT License

Currently it has:

  1. user-user / item-item collaborative filtering
  2. SVD ( based on scipy's implementation )
  3. Simon Funk's SVD
  4. Factorization Machine
  5. Wide and Deep Network

Install the latest version by running

pip install git+https://github.com/mayukh18/reco.git

Or you can install (old version) from PyPI by running

pip install reco

References:

  1. Badrul Sarwar, George Karypis, Joseph Konstan, and John Riedl. Item-Based Collaborative Filtering Recommendation Algorithms, 2001.[pdf]

  2. Simon Funk's Blog. Netflix Update: Try This at Home. [link]

  3. Arkadiusz Paterek. Improving regularized singular value decomposition for collaborative filtering, 2007. [pdf]

  4. Steffen Rendle. Factorization Machines, 2010. [pdf]

  5. Heng-Tze Cheng et al. Wide & Deep Learning for Recommender Systems, 2016. [pdf]

Two small examples to get you started

FunkSVD

from reco.recommender import FunkSVD
from reco.metrics import rmse
from reco.datasets import loadMovieLens100k

train, test, _, _ = loadMovieLens100k(train_test_split=True)

f = FunkSVD(k=64, learning_rate=0.002, regularizer = 0.05, iterations = 150, method = 'stochastic', bias=True)

# fits the model to the data
f.fit(X=train, formatizer={'user':'userId', 'item':'itemId', 'value':'rating'},verbose=True)

# predicts the ratings from the test set
preds = f.predict(X=test, formatizer={'user':'userId', 'item':'itemId'})
print(rmse(preds, list(test['rating']))

SVDRecommender

from reco.recommender import SVDRecommender
from reco.datasets import loadMovieLens100k
from reco.metrics import rmse

train, test, _, _ = loadMovieLens100k(train_test_split=True)

svd = SVDRecommender(no_of_features=8)

# Creates the user-item matrix, the userIds on the rows and the itemIds on the columns.
user_item_matrix, users, items = svd.create_utility_matrix(train, formatizer={'user':'userId', 'item':'itemId', 'value':'rating'})

# fits the svd model to the matrix data.
svd.fit(user_item_matrix, users, items)

# predict the ratings from test set
preds = svd.predict(test, formatizer = {'user':'userId', 'item': 'itemId'})
print(rmse(preds, list(test['rating'])))

test_users = [1, 65, 444, 321]
# recommends 4 undiscovered items per each user
results = svd.recommend(test_users, N=4)

# outputs 5 most similar users to user with userId 65
similars = svd.topN_similar(x=65, N=5, column='user')

More examples are available here

Partial documentation available here

reco's People

Contributors

mayukh18 avatar hsinweili avatar

Watchers

James Cloos 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.