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

Interpreting the movie clusters

In this section, we review the code where we get the predictions for each label and save them in a text file and draw a two-dimensional scatter plot.

We will create two scatter plots, one for users and the other for items (which is movies in this case):

object MovieLensKMeansPersist {   val BASE= "./data/movie_lens_libsvm_2f"   val time = System.currentTimeMillis()   val formatter = new SimpleDateFormat("dd_MM_yyyy_hh_mm_ss")   import java.util.Calendar   val calendar = Calendar.getInstance()   calendar.setTimeInMillis(time)   val date_time = formatter.format(calendar.getTime())   def main(args: Array[String]): Unit = {     val spConfig = (     new SparkConf).setMaster("local[1]").     setAppName("SparkApp").  set("spark.driver.allowMultipleContexts", ...

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