Question: This problem is giving me a difficult time could you please help. The file movie_reviews.txt is given to you (see Blackboard for the file movie_reviews.txt).

This problem is giving me a difficult time could you please help.

The file movie_reviews.txt is given to you (see Blackboard for the file

movie_reviews.txt).

movie_reviews.txt:

Nancy Pollock,Lawrence of Arabia,2.5,Gravity,3.5,The Godfather,3.0,Prometheus,3.5,For a Few Dollars More,2.5,The Guns of Navarone,3.0

Jack Holmes,Lawrence of Arabia,3.0,Gravity,3.5,The Godfather,1.5,Prometheus,5.0,The Guns of Navarone,3.0,For a Few Dollars More,3.5

Mary Doyle,Lawrence of Arabia,2.5,Gravity,3.0,Prometheus,3.5,The Guns of Navarone,4.0

Doug Redpath,Gravity,3.5,The Godfather,3.0,The Guns of Navarone,4.5,Prometheus,4.0,For a Few Dollars More,2.5

Jill Brown,Lawrence of Arabia,3.0,Gravity,4.0,The Godfather,2.0,Prometheus,3.0,The Guns of Navarone,3.0,For a Few Dollars More,2.0

Trevor Chappell,Lawrence of Arabia,3.0,Gravity,4.0,The Guns of Navarone,3.0,Prometheus,5.0,For a Few Dollars More,3.5

Peter,Gravity,4.5,For a Few Dollars More,1.0,Prometheus,4.0

The file contains names of reviewers and their reviews of different movies in the

comma separated format. The first string is the name of the reviewer followed by a

name of a movie and its rating. You are required to compose a Python program that

computes a similarity score between any two reviewers using Euclidean distances.

The Euclidean distance between Peter and Trevor Chappell is computed as follows:

1) Only consider the movies that both have reviewed.

2) Take the difference between corresponding reviews.

3) Sum the square of the differences

4) The square root of the sum of differences is the Euclidean score. The shorter

the distance the closer the two reviewers.

For our example, this would be: (4.0 - 4.5)2 + (3.5 - 1.0)2 + (5.0 - 4.0)2 = 0.25 +

6.25 + 1 = 7.5

Euclidean distance is Square Root of 7.5 = 2.7386

Your program should provide the following:

1) Ability to read in a user provided filename which contains movie reviews in the

comma separated format similar to the given file movie_reviews.txt

2) Functionality to compute the similarity between two reviewers provided by the

user

3) Functionality to compute the similarity between one user provided reviewer and

all other reviewers in the database

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!