April 2018
Beginner
552 pages
13h 58m
English
import json import numpy as np
# The following code will return the Euclidean distance score between user1 and user2:
def euclidean_dist_score(dataset, FirstUser, SecondUser):
if FirstUser not in dataset:
raiseTypeError('User ' + FirstUser + ' not present in the dataset')
if SecondUser not in dataset:
raiseTypeError('User ' + SecondUser + ' not present in the dataset')
# Movies rated by both FirstUser and SecondUser ...