April 2017
Intermediate to advanced
532 pages
12h 39m
English
As MLlib's recommendation model is based on matrix factorization, we can use the factor matrices computed by our model to compute predicted scores (or ratings) for a user. We will focus on the explicit rating case using MovieLens data; however, the approach is the same when using the implicit model.
The MatrixFactorizationModel class has a convenient predict method that will compute a predicted score for a given user and item combination as shown in the following code:
val predictedRating = model.predict(789, 123)
The output is as follows:
14/03/30 16:10:10 INFO SparkContext: Starting job: lookup at MatrixFactorizationModel.scala:4514/03/30 16:10:10 INFO DAGScheduler: Got ...
Read now
Unlock full access