Question: def predict _ from _ sim ( self , uid,mid ) : Predict a user rating on a movie given userID and
def predictfromsimselfuid,mid:
Predict a user rating on a movie given userID and movieID
# Predict user rating as follows:
# Get entry of user id in rating matrix
# Get entry of movie id in sim matrix
# Employ and to predict user rating of the movie
# your code here
useridx self.uididxuid
movieidx self.mididxmid
simratings self.Mruseridx self.simmovieidx
# printsimratingssimratings
simsum npsumselfsimmovieidx
return npsumsimratingssimsum if simsum else
# Sample tests for predictfromsim in RecSys class
assertsamplecbpredictfromsimapproxabse "Check predictfromsim. Look at how you predicted a user rating on a movie given UserID and movieID."
assertsamplecbpredictfromsimapproxabse "Check predictfromsim. Look at how you predicted a user rating on a movie given UserID and movieID."
Error Message:
AssertionError Traceback most recent call last
in
# Sample tests for predictfromsim in RecSys class
assertsamplecbpredictfromsimapproxabse "Check predictfromsim. Look at how you predicted a user rating on a movie given UserID and movieID."
assertsamplecbpredictfromsimapproxabse "Check predictfromsim. Look at how you predicted a user rating on a movie given UserID and movieID."
AssertionError: Check predictfromsim. Look at how you predicted a user rating on a movie given UserID and movieID.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
