From 8e06af0e2e73f45fb1c5a1e032d601930566e91c Mon Sep 17 00:00:00 2001 From: j Date: Wed, 23 May 2018 21:29:18 +0200 Subject: [PATCH] don't reuse playlists --- recommendation_engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recommendation_engine.py b/recommendation_engine.py index 9679ec7..b08f010 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -96,13 +96,13 @@ class Engine: playlists = playlists[channels['userKeywords']:] # For each playlist, compute global keyword score score = {} - for playlist in self.playlists: + for playlist in playlists: score[playlist['name']] = random.random() for tag in [tag for tag in playlist['tags'] if tag in sliders]: score[playlist['name']] += sliders[tag] # Select highest scoring playlists playlists = sorted( - self.playlists, + playlists, key=lambda playlist: -score[playlist['name']] ) videos += playlists[:channels['globalKeywords']]