A TensorFlow recommendation algorithm and framework in Python.
Clone or download
jfkirk Merge pull request #108 from jfkirk/fix-plt-mvlns
BUG: Fixes plot closing in plot_movielens
Latest commit 005c74a Oct 10, 2018



A TensorFlow recommendation algorithm and framework in Python.

PyPI version Build Status Gitter chat

What is TensorRec?

TensorRec is a Python recommendation system that allows you to quickly develop recommendation algorithms and customize them using TensorFlow.

TensorRec lets you to customize your recommendation system's representation/embedding functions and loss functions while TensorRec handles the data manipulation, scoring, and ranking to generate recommendations.

A TensorRec system consumes three pieces of data: user_features, item_features, and interactions. It uses this data to learn to make and rank recommendations.

For an overview of TensorRec and its usage, please see the wiki.

For more information, and for an outline of this project, please read this blog post.

For an introduction to building recommender systems, please see these slides.

TensorRec System Diagram

Example: Basic usage

import numpy as np
import tensorrec

# Build the model with default parameters
model = tensorrec.TensorRec()

# Generate some dummy data
interactions, user_features, item_features = tensorrec.util.generate_dummy_data(

# Fit the model for 5 epochs
model.fit(interactions, user_features, item_features, epochs=5, verbose=True)

# Predict scores and ranks for all users and all items
predictions = model.predict(user_features=user_features,
predicted_ranks = model.predict_rank(user_features=user_features,

# Calculate and print the recall at 10
r_at_k = tensorrec.eval.recall_at_k(predicted_ranks, interactions, k=10)

Quick Start

TensorRec can be installed via pip: pip install tensorrec