Skip to content
Building recommender systems in Julia
Branch: master
Clone or download
Latest commit 89bf542 Apr 1, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
examples/ml-100k
src
test
.gitignore
.travis.yml Add docs with Documenter Mar 23, 2019
LICENSE Update LICENSE file Oct 20, 2016
README.md
REQUIRE

README.md

Recommendation.jl

Build Status Recommendation Recommendation

Recommendation.jl is a Julia package for building recommender systems.

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

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

or set of events:

const n_user = 5
const n_item = 10

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

da = 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(da)

and building a recommendation engine should be easy:

build(recommender)

Personalized recommenders sometimes require us to specify the hyperparameters:

recommender = MF(da, Parameters(:k => 2))
build(recommender, learning_rate=15e-4, max_iter=100)

Once a recommendation engine has been built successfully, top-k recommendation for a user u with item candidates candidates is performed as follows:

u = 4
k = 2
candidates = [i for i in 1:n_item] # all items

recommend(recommender, u, k, candidates)
You can’t perform that action at this time.