Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started