Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //take only age groups and movies
- //userID //age //Set(movie, rating) //dropped genre, because it is not needed
- val ageGroupsMovies = all.map(x => (x._1, (x._2._1._3, x._2._2)))
- //take the first age group and create new RDD containing only movies and ratings (and genres, dammit)
- val justMovies = ageGroupsMovies.filter(x => x._2._1 == 1).flatMap(x => x._2._2)
- val plaa2 = justMovies.map(x => (x._1, x._2)).groupByKey
- val moviesAndRatings = plaa2.map(x => (x._1, (x._2.reduce(_ + _).toFloat / x._2.size)))
- def order(arr: Array[(String, Float)]) : Int = {
- return 0
- }
- val plaa = moviesAndRatings.top(10)
- plaa.foreach {println}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement