The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 327 Weeks Ago, 5 Days Ago |
| Questions Answered: | 12843 |
| Tutorials Posted: | 12834 |
MBA, Ph.D in Management
Harvard university
Feb-1997 - Aug-2003
Professor
Strayer University
Jan-2007 - Present
****Full Assignment Attached
Problem Definition
Let’s say we have two users, User P and User Q, and they have rated 6 different cell phone brands on a scale of 1 to 10.
|
Item |
Ratings of User P |
Ratings of User Q |
|
Apple |
0 |
|
|
Samsung |
||
|
Nokia |
||
|
Motorola |
9 |
|
|
LG |
||
|
Sony |
In Python, we can depict these ratings as two lists:
UserPRatings = [10, 5, 7, 9, 3, 1]
UserQRatings = [5, 10, 4, 1, 3, 6]
We would like to find the Manhattan, Euclidean, and Minkowski () Distances between these two lists.
Requirement for this Assignment
Write a single “for” loop with the “range” function to calculate the Manhattan, Euclidean, and Minkowski distances between these two lists.
Recall that, given two lists P and Q, each of length n, the Distance Measures can be calculated as follows:
Manhattan distance is computed as follows:
Euclidean distance is computed as follows:
Minkowski distance () is computed as follows:
Spring CIS 415 – Assignment 1This assignment is worth 20 points.Problem DefnitionLet’s say we have two users, User P and User Q, and they have rated 6 diferent cell phone brands on ascale oF 1 to 10.ItemRa±ngs oF User PRa±ngs oF User QApplep0=10q0=5Samsungp1=5q1=10Nokiap2=7q2=4Motorolap3=¿9q3=1LGp4=3q4=3Sonyp5=1q5=6In Python, we can depict these ra±ngs as two lists:UserPRatngs= [10, 5, 7, 9, 3, 1]UserQRatngs= [5, 10, 4, 1, 3, 6]We would like to ²nd the Manha³an, Euclidean, and Minkowski (r=3) Distances between these two lists.Requirement For this AssignmentWrite asingle“For” loop with the “range” Func±on to calculate the Manha³an, Euclidean, andMinkowski distances between these two lists.Recall that, given two lists P and Q, each oF length n, the Distance Measures can be calculated as Follows:Manha³an distance is computed as Follows:∑i=0n−1¿pi−qi∨¿¿Euclidean distance is computed as Follows:
Attachments:
-----------