Created
June 5, 2019 18:22
-
-
Save deansublett/b7788c7b9fe888231a4ca328458a65ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My own recommender system | |
# half/half recommendation based on scaled weighted average & popularity score | |
from sklearn import preprocessing | |
min_max_scaler = preprocessing.MinMaxScaler() | |
movies_scaled = min_max_scaler.fit_transform(movies_clean[['weighted_average', 'popularity']]) | |
movies_norm = pd.DataFrame(movies_scaled, columns=['weighted_average', 'popularity']) | |
movies_norm.head() | |
movies_clean[['norm_weighted_average', 'norm_popularity']] = movies_norm | |
movies_clean['score'] = movies_clean['norm_weighted_average'] * 0.5 + movies_clean['norm_popularity'] * 0.5 | |
movies_scored = movies_clean.sort_values(['score'], ascending=False) | |
movies_scored[['original_title', 'norm_weighted_average', 'norm_popularity', 'score']].head(20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment