O'Reilly logo

Machine Learning with Spark - Second Edition by Nick Pentreath, Manpreet Singh Ghotra, Rajdeep Dua

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Rating count bar chart

Looking at the results, the average rating given by a user to a movie is around 3.5, so we might expect that the distribution of ratings will be skewed towards slightly higher ratings. Let's see whether this is true, by creating a bar chart of rating values using a similar procedure as we did for occupations.

The code for plotting ratings versus count is shown here. This is available in the file CountByRatingChart.scala:

object CountByRatingChart {   def main(args: Array[String]) {     val customSchema = StructType(Array(       StructField("user_id", IntegerType, true),       StructField("movie_id", IntegerType, true),       StructField("rating", IntegerType, true),       StructField("timestamp", IntegerType, true)))  val spConfig = (new ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required