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(
"./data/movie_lens_libsvm/movie_lens_users_libsvm...