Create an array that represents recommended ratings

Assignment Help Computer Engineering
Reference no: EM131317750

Description

This assignment will provide you with practice using arrays.

Your job is to build a simple Recommender System, similar to the one that Netflix (an online movie-rental service) uses to recommend movies to customers. The basic idea is to find out some movies that a user likes, and then recommend other movies that the user might also like.

On Oct. 2, 2006, Netflix announced a challenge to programmers everywhere to come up with a better way of figuring out how to predict what movies to recommend to users. They offered a prize of $1 million to anyone who could beat their own technique by 10% in prediction accuracy. A team of programmers eventually claimed the prize in 2009. You can read about the challenge on Wikipedia, or on Netflix's own page about it. This assignment is a simplified version of the kinds of recommendation techniques used by Netflix, Amazon, and others.

Helper code: The MovieFileHelper class

For this assignment, you will need the class MovieFileHelper. The code is available here. This class includes two methods that you will need to use for your assignment, but YOU DO NOT NEED TO UNDERSTAND HOW THEY WORK. The code for these methods involve several things you have not learned yet. Feel free to look at them and try to understand them, but it is not necessary to understand their code to do this assignment.

You will also need to download these two files, movies.txt and ratings.txt. The first one stores the names of 20 Hollywood movies. The second one stores movie ratings from 30 (fictional) users, who rated these 20 movies between 0 and 5 (5 being the best), or -1 if they haven't seen it.

The first method that is useful to you in MovieFileHelper is loadMovieNames(String filename). When you call this method with the String "movies.txt", it will load all of the movie names from that file into an array of Strings, and return that array.

The second method for you to use in MovieFileHelper is loadRatings(String filename). When you call this method with the String "ratings.txt", it will load all of the recommendations from that file into a 2-D array of doubles, and return that array.

Your Task

Create a Java file called Recommender.java. Your program should behave as follows:

• Using the helper class and text files described above, load the 20 movie names and the movie ratings from 30 people into two arrays in memory.

• Ask the user to enter a rating (between 1 and 5, or -1 if they haven't seen it) for each movie.

• Create a method that determines a score for each of the 30 people, which represents how similar that person's tastes are to the current user's tastes. Store these similarity scores in an array of 30 doubles. The similarity scores should be between 0 and 1 each.

• Create an array that represents recommended ratings for the user. There should be 20 numbers in this array, one for each movie. The number for each movie 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.

• Display the names of the top-3 ranked movies (according to the recommended ratings from the previous step) that the user has not seen yet.

Suggestions and hints

Don't try to program everything all at once. Do it in parts, by writing some methods that accomplish part of the whole assignment. Write some println commands that show what's going on in memory after you call a method that you've just written, and run your program to make sure that the new method is working correctly. Repeat this for each new method you write.

You can come up with your own way of judging how similar 2 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)).

The mathematical formula for a weighted average, where there are N numbers stored in an array called a, and N corresponding weights stored in an array called w, goes like this:

weighted_average(N, a, w) = (a1*w1 + a2*w2 + ... + aN*wN) / (w1 + ... + wN)

Reference no: EM131317750

Questions Cloud

What is anthropogenically driven sea level : How can past ea level changes inform us about future anthropogenically driven sea level changes
What is the variance of portfolio : 1. Your portfolio is invested 40 percent each in A and C and 20 percent in B. what is the expected rate of return of the portfolio? 2. What is the variance of this portfolio? The standard Deviation?
Does this situation present a conflict of interest for you : Does this situation present a conflict of interest for you?Discuss how you will fulfill your duties as agent to both of these athletes, and what disclosures, if any, should be made to each athlete.Discuss the nature of an agent's duty to a principa..
Expected return on a portfolio : Using CAPM: A stock has a beta of 1.3 and an expected return of 15 percent. A risk free asset currently earns 5.5 percent. What is the expected return on a portfolio that is equally invested in the two assets?
Create an array that represents recommended ratings : Create a Java file called Recommender.java. Your program should behave as follows: Create an array that represents recommended ratings for the user. There should be 20 numbers in this array, one for each movie.
Identify one independent variable from your problem : Identify one independent variable from your problem statement in previous unit.How is the independent variable you've identified going to be represented? What is one indicator that could be used to represent this variable?Identify one dependent var..
Explain the nature of frequency shifting in each case : Identify the frequencies in the baseband, and the corresponding frequencies in the DSBSC, USB, and LSB spectra. Explain the nature of frequency shifting in each case.
Acquire in exchange : Assume that ¥87.04 equal $1. Also assume that 6.5614SKr equal $1. How many Japanese yen can you acquire in exchange for 4,300 Swedish krona?
Define and initialize tmp mains activation record : Define & initialize tmp main's activation record. When we write the contents of the stack, we write the contents of the whole stack, including previous activation records.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Determining the spped of a computer

determining the spped of a computer

  Which pairs of statements are equivalent

Which of the following is a proper use of naming convention for a control? Which of the following pairs of statements are equivalent?

  Provide an example of a set f of functional dependencies

Provide an example of a set F of functional dependencies and a schema R such that R consists of 2 attributes and R is not in 3NF. If you cannot do that, describe why you can't.

  Write a class that encapsulates a deck of cards

Write a class (and a client class to test it) that encapsulates a deck of cards. A deck of cards is made up of 52 cards. You should have three instance variables.

  Obtains the choice and show action based on that choice

Implements a switch: show the user three choices, obtains the choice and display an action based on that choice. One of the actions will include an if..else. Also include a default for incorrect choices.

  Icmp packets

Involve at least five ICMP packets, and also explain why they would be a problem on the network.

  Different visual basic command

Write down the visual basic command in order to Load a LVM file ( file name: Data.lvm), Delete the first 22 row , Insert a new column from 0 to last row of file with increment of 0.1 ( For example, if there are 25 rows in Data.lvm; then 25-22=3, it w..

  Program utilizing small basic

Write down a program utilizing the Small Basic which prompts the user to input two integers: firstNum and secondNum (firstNum should be less than secondNum). Then utilizing the firstNum and secondNum:

  The currency conversion application is a menu-driven

the final project consists of a currency conversion application. this application-similar to simple practical programs

  Design a modified priority encoder

Design a modified priority encoder that receives an 8-bit input, A7:0, and produces two 3-bit outputsm Y2:0 and Z 2:0 Y indicates the most significant bit of the input that is TRUE.

  Prove or disprove the statement

What if the segments could intersect each other, but must all have unique slopes?

  Would the system ever acknowledge the given data

If the transfer is a "read," at which point would the system have good data in the buffer? Would the system ever acknowledge this data?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd