Skip to content
Building recommender systems in Julia
Julia
Branch: master
Clone or download
Latest commit 894d259 Jul 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Simplify usage example Jul 21, 2019
examples/ml-100k Close #7: Add missing comma Jul 25, 2019
src Make matrix/vector value type configureable Jul 22, 2019
test Refactor: s/da/data/ Jul 21, 2019
.gitignore Add docs with Documenter Mar 23, 2019
.travis.yml Enable Coverall tracking Jul 20, 2019
LICENSE Update LICENSE file Oct 20, 2016
Project.toml Bump v0.3.0 Jul 21, 2019
README.md Simplify usage example Jul 21, 2019

README.md

Recommendation.jl

Build Status Coverage Status

Recommendation.jl is a minimal, customizable Julia package for building recommender systems. Pre-built basic functionalities include:

  • Non-personalized baselines that give unsophisticated, rule-based recommendation.
  • Collaborative filtering on either explicit or implicit user-item matrix.
  • Content-based filtering by using the TF-IDF weighting technique.
  • Evaluation based on a variety of rating and ranking metrics, with easy-to-use N-fold cross validation executor.

Installation

julia> using Pkg; Pkg.add("Recommendation")

Usage

This package contains DataAccessor and several fundamental recommendation techniques (e.g., non-personalized MostPopular recommender, CF and MF), and evaluation metrics such as Recall:

overview

All of them can be accessible by loading the package as follows:

using Recommendation

First of all, you need to create a data accessor from a matrix:

using SparseArrays

data = DataAccessor(sparse([1 0 0; 4 5 0]))

or set of events:

n_user, n_item = 5, 10

events = [Event(1, 2, 1), Event(3, 2, 1), Event(2, 6, 4)]

data = DataAccessor(events, n_user, n_item)

where Event() is a composite type which represents a user-item interaction:

type Event
    user::Int
    item::Int
    value::Float64
end

Next, you can pass the data accessor to an arbitrary recommender as:

recommender = MostPopular(data)

and building a recommendation engine should be easy:

build!(recommender)

Personalized recommenders sometimes require us to specify the hyperparameters:

help?> Recommendation.MF
  MF(
      data::DataAccessor,
      k::Int
  )
recommender = MF(data, 2)
build!(recommender, learning_rate=15e-4, max_iter=100)

Once a recommendation engine has been built successfully, top-2 recommendation for a user 4 is performed as follows:

# for user#4, pick top-2 from all items
recommend(recommender, 4, 2, collect(1:n_item))

See documentation for the details.

You can’t perform that action at this time.