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

Effect of iterations on WSSSE

Let us find out the effect of iterations on WSSSE for the MovieLens dataset. We will calculate WSSSE for various values of iterations and plot the output.

The code listing is:

object MovieLensKMeansMetrics {   case class RatingX(userId: Int, movieId: Int, rating: Float,     timestamp: Long)   val DATA_PATH= "../../../data/ml-100k"   val PATH_MOVIES = DATA_PATH + "/u.item"   val dataSetUsers = null   def main(args: Array[String]): Unit = {     val spConfig = (new       SparkConf).setMaster("local[1]").setAppName("SparkApp").       set("spark.driver.allowMultipleContexts", "true")     val spark = SparkSession       .builder()       .appName("Spark SQL Example")       .config(spConfig)       .getOrCreate()  val datasetUsers = spark.read.format("libsvm").load( ...

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