Recall that in Chapter 6, Collaborative Filtering versus Content-Based Recommendation Engines, we trained a collaborative filtering based model using an ALS implementation of Apache Spark. Now that we already have it persisted we will re-use it to provide recommendations on a customer page.
Remember that when we trained that model, we had to create a rating object. This object had
productId, and a rating value. However, these values are specific to the algorithm, and are not related to our products, and customer IDs. So first, we need to recover those mappings. The following change to
AmazonRatingALS does the job for us:
With this change, we will have both customer and product mappings, which we will use to ...