Recommendations from binary data
So you see from the ROEM, these models can still generate meaningful test predictions. Let's look at the actual recommendations now.
The col function from the pyspark.sql.functions class has been imported for you.
Deze oefening maakt deel uit van de cursus
Building Recommendation Engines with PySpark
Oefeninstructies
- The dataframe
original_ratingsis provided for you. It contains the original ratings that users provided. Use.filter()to examine user 26's original ratings. - The dataframe
binary_recsis also provided. It contains the recommendations for each user. Use.filter()to examineuserId == 26recommendations. Do they seem consistent with the recommendations the model provided? - Do the same thing with user 99. Feel free to examine other users.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# View user 26's original ratings
print ("User 26 Original Ratings:")
____.____(col("userId") == 26).show()
# View user 26's recommendations
print ("User 26 Recommendations:")
binary_recs.filter(col("____") == 26).show()
# View user 99's original ratings
print ("User 99 Original Ratings:")
____.filter(____("userId") == 99).show()
# View user 99's recommendations
print ("User 99 Recommendations:")
binary_recs.filter(col("userId") == ____).show()