Giter VIP home page Giter VIP logo

recommender's Introduction

recommender

Build Status codecov.io

The recommender package provides collaborative filter based product recommendations.

Installation

The newest development release can be installed from GitHub:

# install.packages('devtools')
devtools::install_github("byapparov/recommender")

Similar products model

To create a model for similar products recommender you will need a history of user-to-product interactions in a data.frame where first collumn identifies the user and second column identifies a product, e.g.:

  user.hits <- data.table(
    users =    c("u1", "u2", "u1", "u3", "u2", "u1"),
    products = c("p1", "p2", "p3", "p2", "p3", "p4")
  )
  model <- similarityRecommender(user.hits)

Product interaction history columns are matched according to order:

  1. User Identifier (any name)
  2. Product Identifier (any name)

Any other columns in the table will be ignored.

Item-to-item recommendations

recommendComplimentaryProducts() function provides "others also viewed" type of recommendations.

 # table of products which will be linked to recommendations
 products <- data.table(sku = c("a", "b", "c", "d"),
                         type = c("p1", "p2", "p3", "p1"))

 # Get 5 most similar products for each product in the `products` table
 product.affinity <- recommendComplimentaryProducts(model, products, limit = 5)

User-to-item recommendations

recommendSimilarProducts() function provides "similar products" recommendations based on the user-item interactions data.

  # product interactions stream of new users
  page.views <- data.table(
    user = c("u1", "u1", "u2", "u3", "u3", "u3"),
    sku = c("a", "b",   "c",  "a",  "a", "d")
  )
  
  # `groups` in the filter limit number of recommended products
  # from the same group to one. this can be useful in cases where 
  # distance between recommended items should be increased
  # 
  # `values` in the filter limit number of items returned per user
  groups <- c("a" = "p1", "b" = "p2", "c" = "p3", "d" = "p1")
  filter <- makeRecommendationsFilter(groups, values = 1)
  
  # make user-to-item recommendations table
  res <- recommendSimilarProducts(  
    test.sim.model, 
    page.views, 
    exclude.same = T, 
    filter = filter
  )

recommender's People

Contributors

byapparov avatar lmavridis avatar

Watchers

James Cloos avatar  avatar

Forkers

lulzzz lurst

recommender's Issues

Investigate if recommenderlab provides correct results

library(recommenderlab)
data <- readRDS("hits.rds")
data$hit <- 1L
m <- dcast(data, visitor.id ~ sku, mean, value.var = "hit", fill = 0L)
m <- data.matrix(m)
rm <- as(m, "realRatingMatrix")
m <- binarize(m, minRating = 1)

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.