April 2017
Intermediate to advanced
532 pages
12h 39m
English
We will use the ALS algorithm to get numerical features for users and items (movies) in this case before we can use the clustering algorithm on the data:
val ratings = spark.sparkContext .textFile(DATA_PATH + "/u.data") .map(_.split("\t")) .map(lineSplit => Rating(lineSplit(0).toInt, lineSplit(1).toInt, lineSplit(2).toFloat, lineSplit(3).toLong)) .toDF()
val Array(training, test) = ratings.randomSplit(Array(0.8, 0.2))
val als = new ALS() .setMaxIter(5) ...Read now
Unlock full access