Skip to content

A toy project to build a baseline Recommendations System based on Matrix Factorization using TensorFlow

Notifications You must be signed in to change notification settings

francovm/recsys-mf-tf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Baseline RecSys with Matrix Factorization

Version License: APACHE GitHub code size in bytes Python version

Simple Recommender System model via matrix factorization to build a strong baseline.

Install

From repository

pip install -e git+https://github.com/francovm/recsys-mf-tf.git#egg=recsys-mf

Training

from src.data import load_rating
from src.model import MFmodel, Recommender
import pandas as pd

data = load_rating(variant="100K")
df = pd.DataFrame(data, columns=["user_id", "item_id", "rating"])

model = MFmodel(regularization_coeff=0.1, gravity_coeff=1.0, embedding_dim=30, init_stddev=.05).fit(df)

model.train(num_iterations=2000, learning_rate=20.)

Movie recommendation

from src.model import MFmodel, Recommender, movie_neighbors, compute_scores

movie_neighbors(model, movies ,"Forrest Gump", cosine=False)

Output

	score	titles	genres
68	10.440863	Forrest Gump (1994)	Comedy-Romance-War
63	10.242167	Shawshank Redemption, The (1994)	Drama
317	10.217667	Schindler's List (1993)	Drama-War
173	9.372114	Raiders of the Lost Ark (1981)	Action-Adventure
422	9.129416	E.T. the Extra-Terrestrial (1982)	Children-Drama-Fantasy-Sci-Fi
97	9.091332	Silence of the Lambs, The (1991)	Drama-Thriller

Author

👤 **Franco Vega **

Give a ⭐️ if this project helped you!

About

A toy project to build a baseline Recommendations System based on Matrix Factorization using TensorFlow

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages