0

I have a movielens dataset. I want to make a recommendation system based on the input but I'm having trouble doing the model transform.

# get the recommendations for the users
recommendations_df = model.transform(rated_users)

IllegalArgumentException: movieId does not exist. Available: userId

my code like this :

# create the ALS model
als = ALS(userCol="userId", itemCol="movieId", ratingCol="rating", coldStartStrategy="drop")

# fit the model to the training data
model = als.fit(training)

# get the movie input
idmovie = int(input("Enter movie ID: "))

# get the users who have rated the input movie
rated_users = ratings.filter(movie_ratings["movieId"] == idmovie).select("userId")

got error in :

# get the recommendations for the users
recommendations_df = model.transform(rated_users)

0 Answers0