Giter Club home page Giter Club logo

matrix-factorization-recommender-systems-netflix-paper-implementation's Introduction

ML Matrix Factorization recommender

Implementation of the winning recommender system from the Netflix competition. Uses matrix decomposition to derive a P and Q matrix which can be used to make predictions.
Uses gradient descent to arrive at the solution.

How to Use.

Predict using the ProductRecommender Class.
Can be used in two ways:

  1. First: To recommend using only a users x product matrix along with a k value for # of features to discover.
    #import predictor
    from recommender.matrix_factor_model import ProductRecommender
    
    # fake data. (2 users, three products)
    user_1 = [1, 2, 3]
    user_2 = [0, 2, 3]
    data = [user_1, user_2]
    
    # train model
    modelA = ProductRecommender()
    modelA.fit(data)
    
    # predict for user 2 
    modelA.predict_instance(1)
    # prints array([ 0.9053102 ,  2.02257811,  2.97001565])
  1. Second: To recommend when you want to provide a list of features for movies and only learn P (user -> feature strength).
    #import predictor
    from recommender.matrix_factor_model import ProductRecommender
    
    # fake data. (2 users, three products)
    user_1 = [1, 2, 3]
    user_2 = [0, 2, 3]
    data = [user_1, user_2]
    
    # product features (year made, height)
    product_1 = [2014, 74]
    product_2 = [2016, 89]
    Q = [product_1, product_2]
    
    # train model passing in Q
    modelB = ProductRecommender()
    modelB.fit(data, Q)
    
    # predict for user 2 
    modelB.predict_instance(1)
    # prints array([ 0.9053102 ,  2.02257811,  2.97001565])

Defaults

parameter default value description
user_x_product Must provide User x product Matrix
product_x_features Optional (null) Products_x_features matrix. Sets latent_features_guess to number of features here.
latent_features_guess 2 Features we want to learn
learning_rate 0.0002 Size of learning steps
steps 5000 Max number of steps until convergence
regularization_penalty 0.02 Penalty for over/under fitting
convergeance_threshold 0.001 Error amount to terminate (we solved the problem). Otherwise uses steps.

License

MIT

Author

William Falcon

matrix-factorization-recommender-systems-netflix-paper-implementation's People

Contributors

williamfalcon 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.