Skip to content

Instantly share code, notes, and snippets.

@Harshit1694
Created June 21, 2019 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Harshit1694/a8d79d564b0edea276857e15e0ae62e0 to your computer and use it in GitHub Desktop.
Save Harshit1694/a8d79d564b0edea276857e15e0ae62e0 to your computer and use it in GitHub Desktop.
#Grouping movie_id with mean rating
popularity_rec<-aggregate(data_train[, 3], list(data_train$movie_id), mean)
head(popularity_rec)
#Arranging the mean rating in descending order by expanding the selection with movie_id
popularity_rec<- popularity_rec[order(-popularity_rec$x),]
colnames(popularity_rec)<-c("movie_id","rating")
#Recommended movies with top ratings
head(popularity_rec,20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment