using knn to predict rating for movie alrightwe're going to actually take the simple idea of knn and apply that to more complicated problemand that' predicting the rating of movie given just its genre and rating information solet' dive in and actually try to predict movie ratings just based on the knn algorithm and see where we get soif you want to follow alonggo ahead and open up the ,//jqzoc and you can play along with me what we're going to do is define distance metric between movies just based on their metadata by metadata just mean information that is intrinsic to the moviethat isthe information associated with the movie specificallywe're going to look at the genre classifications of the movie every movie in our pwjf-fot dataset has additional information on what genre it belongs to movie can belong to more than one genrea genre being something like science fictionor dramaor comedyor animation we will also look at the overall popularity of the moviegiven by the number of people who rated itand we also know the average rating of each movie can combine all this information together to basically create metric of distance between two movies just based on rating information and genre information let' see what we get we'll use pandas again to make life simpleand if you are following alongagain make sure to change the path to the pwjf-fot dataset to wherever you installed itwhich will almost certainly not be what is in this python notebook please go ahead and change that if you want to follow along as beforewe're just going to import the actual ratings data file itselfwhich is ebub using the sfbe@dtw function in pandas we're going to tell that it actually has tab-delimiter and not comma we're going to import the first columnswhich represent the vtfs@jenpwjf@jeand ratingfor every individual movie rating in our datasetjnqpsuqboebtbtqe @dpmt sbujoht qesfbe@dtw =%bub djfodf=nm = ebub tfq = obnft @dpmtvtfdpmt sbohf sbujohtifbe sbujohtifbe