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
from pyspark.ml.recommendation import ALS | |
def tune_ALS(train_data, validation_data, maxIter, regParams, ranks): | |
""" | |
grid search function to select the best model based on RMSE of | |
validation data | |
Parameters | |
---------- |
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
def make_recommendations(self, fav_movie, n_recommendations): | |
""" | |
make top n movie recommendations | |
Parameters | |
---------- | |
fav_movie: str, name of user input movie | |
n_recommendations: int, top n recommendations | |
""" | |
# get data | |
movie_user_mat_sparse, hashmap = self._prep_data() |
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
def make_recommendations(self, fav_movie, n_recommendations): | |
""" | |
make top n movie recommendations | |
Parameters | |
---------- | |
fav_movie: str, name of user input movie | |
n_recommendations: int, top n recommendations | |
""" | |
# get data | |
movie_user_mat_sparse, hashmap = self._prep_data() |