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: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 2 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
this is python assignment, I have no idea with the question, plz do that for me, I need to know the answer. I need get step-by-step answers from the python.
Â
Let’s say we have two users, User P and User Q, and they have rated 7 different cell phonebrands on a scale of 1 to 10.
Â
|
Item |
Ratings of User P |
Ratings of User Q |
|
Apple |
1 |
7 |
|
Samsung |
5 |
1 |
|
Nokia |
7 |
4 |
|
Motorola |
8 |
- |
|
LG |
5 |
4 |
|
Sony |
1 |
6 |
|
Blackberry |
7 |
3 |
Â
In Python, we can depict these ratings as two dictionaries:
UserPRatings = {'Apple':1, 'Samsung':5, 'Nokia':7, 'Motorola':8, 'LG':5, 'Sony':1, 'Blackberry':7}
UserQRatings = {'Apple':7, 'Samsung':1, 'Nokia':4, 'LG':4, 'Sony':6, 'Blackberry':3}
Â
We would like to find the Pearson Correlation between these two lists.
Â
This assignment requires you to define and call a Person Correlation function as follows.A framework to get you started has been provided on the next page.
Â
(1) Define afunction called pearsonD.
·        The function must take two (and only two) dictionary parameters - user1ratings and user2ratings - and return the Pearson Correlation between thetwo user ratings.
·        The function must use a single for loop to calculate the Pearson Correlation using the computationally efficient form(similar toSlides 16 and 17 of Knowledge Check3… but using dictionaries instead of lists):
·        The Pearson Correlation calculation mustconsider an item only if it was rated by both users (similar tohow we handled this for Minkowski on Slides 14 and 15 of Knowledge Check 4)
Â
(2) Then call this function for UserPRatings and UserQRatings defined above, and print the person correlation value.
Â
Â
Â
Â
Â
Some things to keep in mind as you code:
·        Make your code readable – for instance, use meaningful variable names and comments.
·        Make your code elegant – for instance, balance the number of variables you introduce – too many or too few make your code difficult to debug, read, and maintain.
·        Make your output readable and user-friendly
Â

Â
Once you have written up the script, save it as follows: <FirstName><LastName>Assignment1.py.
[Example: HinaAroraAssignment1.py]
Â
Submit the script by uploading the above python script. Note: upload the actual script – DO NOT attach a screenshot of the script!
Â
The submitted script will be run as-is for grading. Points will be deducted for scripts that:
·        do not adhere to all of the requirements called out under the requirements section above
·        are difficult to read/follow
·        don’t compile/run
·        don’t have all the various pieces of code required
·        have hard-code values instead of using variables
·        have logical errors
·        don’t result in the expected output
·        don’t have user-friendly output
Â
If you have coded up this assignment correctly, you should end up with a Pearson Correlation of-0.7307.
Attachments:
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly