for our purposesthat' not actually importantrightwe're just trying to measure distance between movies based on their genres soall that matters mathematically is how similar this vector of genres is to another movieokaythe actual genres themselvesnot importantwe just want to see how same or different two movies are in their genre classifications so we have that genre listwe have the popularity score that we computedand we have there the mean or average rating for toy story okaylet' go ahead and figure out how to combine all this information together into distance metricso we can find the -nearest neighbors for toy storyfor example 've rather arbitrarily computed this $pnqvuf%jtubodf functionthat takes two movie ids and computes distance score between the two we're going to base thisfirst of allon the similarityusing cosine similarity metricbetween the two genre vectors like saidwe're just going to take the list of genres for each movie and see how similar they are to each other againa indicates it' not part of that genrea indicates it is we will then compare the popularity scores and just take the raw differencethe absolute value of the difference between those two popularity scores and use that toward the distance metric as well thenwe will use that information alone to define the distance between two movies sofor exampleif we compute the distance between movie ids and this function would return some distance function based only on the popularity of that movie and on the genres of those movies nowimagine scatter plot if you willlike we saw back in our example from the previous sectionswhere one axis might be measure of genre similaritybased on cosine metricthe other axis might be popularityokaywe're just finding the distance between these two thingsgspntdjqzjnqpsutqbujbm efg$pnqvuf%jtubodf  hfosftb hfosftc hfosf%jtubodf tqbujbmejtubodfdptjof hfosft"hfosftqpqvmbsjuzb qpqvmbsjuzc qpqvmbsjuz%jtubodf bct qpqvmbsjuz"qpqvmbsjuzsfuvsohfosf%jtubodf qpqvmbsjuz%jtubodf $pnqvuf%jtubodf npwjf%jdunpwjf%jdu