SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,kenrick Mock
Chapter:
Arrays
Exercise:
Programming Projects
Question:14 | ISBN:9780132846813 | Edition: 5

Question

You have collected reviews from four movie reviewers where the reviewers are

numbered 0–3. Each reviewer has rated six movies where the movies are numbered

100–105. The ratings range from 1 (terrible) to 5 (excellent).

The reviews are shown in the following table:

100 101 102 103 104 105

0 3 1 5 2 1 5

1 4 2 1 4 2 4

2 3 1 2 4 4 1

3 5 1 4 2 4 2

Write a program that stores this data using a 2D array. Based on this information your program should allow the user to enter ratings for any three movies. The program should then find the reviewer whose ratings most closely match the ratings input by the user. It should then predict the user’s interest in the other movies by outputting the ratings by the reviewer for the movies that were not rated by the user. Use the Cartesian distance as the metric to determine how close the reviewer’s movie ratings are to the ratings input by the user. This technique is a simple version of the nearest neighbor classification algorithm. For example, if the user inputs a rating of 5 for movie 102, 2 for movie 104, and 5 for movie 105, then the closest match is reviewer 0 with a distance of sqrt ((5 - 5)2 + (2 - 1)2 + (5 - 5)2) = 1. The program would then predict a rating of 3 for movie 100, a rating of 1 for movie 101, and a rating of 2 for movie 103.


TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Sorry the answer is not available at the moment…

If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.

Spread the 'tradition of sharing'.