Step 6 - Build an ALS user product matrix

Build an ALS user matrix model based on ratingsRDD by specifying the maximal iteration, a number of blocks, alpha, rank, lambda, seed, and implicitPrefs. Essentially, this technique predicts missing ratings for specific users and specific movies based on ratings for those movies from other users who gave similar ratings for other movies:

val rank = 20 val numIterations = 15 val lambda = 0.10 val alpha = 1.00 val block = -1 val seed = 12345L val implicitPrefs = false val model = new ALS().setIterations(numIterations)        .setBlocks(block).setAlpha(alpha)        .setLambda(lambda)        .setRank(rank) .setSeed(seed)        .setImplicitPrefs(implicitPrefs)        .run(ratingsRDD)

Finally, we iterated the model for learning 15 times. ...

Get Scala Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.