SHARE
TWEET

Untitled

a guest Jun 16th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # My own recommender system
  2. # half/half recommendation based on scaled weighted average & popularity score
  3.  
  4. from sklearn import preprocessing
  5.  
  6. min_max_scaler = preprocessing.MinMaxScaler()
  7. movies_scaled = min_max_scaler.fit_transform(movies_clean[['weighted_average', 'popularity']])
  8. movies_norm = pd.DataFrame(movies_scaled, columns=['weighted_average', 'popularity'])
  9. movies_norm.head()
  10.  
  11. movies_clean[['norm_weighted_average', 'norm_popularity']] = movies_norm
  12.  
  13. movies_clean['score'] = movies_clean['norm_weighted_average'] * 0.5 + movies_clean['norm_popularity'] * 0.5
  14. movies_scored = movies_clean.sort_values(['score'], ascending=False)
  15. movies_scored[['original_title', 'norm_weighted_average', 'norm_popularity', 'score']].head(20)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top