Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to make top-k recommendations to all users in a fast way for ALS model. #179

Merged
merged 18 commits into from
Jun 20, 2019
Merged
Prev Previous commit
Next Next commit
PEP8ified
  • Loading branch information
Tych0n committed Jun 20, 2019
commit c7a6fbc3a897f822318a0a76194142933c769d57
2 changes: 1 addition & 1 deletion benchmarks/benchmark_als.py
Original file line number Diff line number Diff line change
@@ -7,9 +7,9 @@
import logging
from collections import defaultdict

import matplotlib.pyplot as plt
import scipy.io

import matplotlib.pyplot as plt
import seaborn
from implicit._als import calculate_loss
from implicit.als import AlternatingLeastSquares
2 changes: 1 addition & 1 deletion benchmarks/benchmark_spark.py
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@
import json
import time

import matplotlib.pyplot as plt
import numpy
import scipy.io

import implicit
import matplotlib.pyplot as plt
import seaborn
from pyspark import SparkConf, SparkContext
from pyspark.ml.recommendation import ALS
2 changes: 1 addition & 1 deletion implicit/recommender_base.pyx
Original file line number Diff line number Diff line change
@@ -228,7 +228,7 @@ class MatrixFactorizationBase(RecommenderBase):
cannot filter {max_row_n} and recommend {N} items\
out of {user_items.shape[1]} available.")
if filter_items:
filter_items = list(set(filter_items)) # Counter dups
filter_items = list(set(filter_items))
if len(filter_items) > user_items.shape[1] - N:
raise ValueError(f"filter_items:\
cannot filter {len(filter_items)} and recommend {N} items\