Reference no: EM131985088
Problem
Airplane Alien Bridesmaids Cloudy with a Chance of Meatballs Exorcist Fantastic Mr. Fox Forrest Gump Hangover Harold and Kumar Go to White Castle The Help Incredibles Jaws Monsters, Inc Psycho Raiders of the Lost Ark Silver Linings Playbook Titanic Twilight Eclipse Up Zoolander
Using java;
Create an array that represents recommended ratings for the user. There should be 20 numbers in this array, one for each movie. higher the number, the more strongly your program thinks the user will like the movie. The number should be the average over all 30 ratings for the movie that are greater than 0 (only include ratings for users who have actually seen the movie). However, it should be a weighted average: people who are more similar to the current user should have a higher weight than people who are less similar.
Calculating Similarity
Your program is going to try to decide whether or not you might like a movie that you haven't yet seen. It's going to come up with a score, which represents the likelihood that you'll enjoy it. If people who have tastes similar to yours seem to like it, the program will assign that movie a higher score. The question is, How do you determine similarity?
You can come up with your own way of judging how similar two people's ratings are. One suggestion is to compute what's called cosine similarity:
For person 1, compute the square of each movie rating for movies they have seen, and add these up and then take the square root. Store the result in a variable called p1. For example, if person 1 saw 3 movies and rated them 4, 4, and 2, then p1 = sqrt(4*4 + 4*4 + 2*2) = sqrt(36) = 6.
Do the same for person 2, and store the result in a variable called p2.
For each movie that both people have seen, compute the product of their ratings. Add up all of these products, and store the result in a variable called both. For example, if person 1 and person 2 both saw movies 7 and 14 (out of 20), and person 1 rated them as 4 for movie 7 and 2 for 14, and person 2 rated them as 2 for movie 7 and 3 for movie 14, then both = 4*2 + 2*3.
The cosine similarity score between person 1 and person 2 is (both / (p1 * p2)).