I need help in my assignment the program is a python programming Assignment 3: The Sound of Music Instructions Problem Statement You have been hired by DJY Music, a new online music streaming service,...


I need help in my assignment the program is a python programming


Assignment 3: The Sound of Music












Instructions


Problem Statement


You have been hired by DJY Music, a new online music streaming service, to create a basic music recommendation system. Your system will be used to recommend music genres that their subscribers should listen to based on the preferences of other subscribers.



Recommendation Algorithms


There are a variety of algorithms that are used by recommendation systems. One approach is to collect information about the music preferences and tastes of a variety of subscribers and then make music recommendations to other subscribers who have similar preferences. The question arises as to what it means for two subscribers to be similar. In this assignment, we will usefuzzy set theoryto calculate similarity between subscribers. If you are interested, there is an upper year course called CISC 490 that focuses on the topic of fuzzy logic – I would highly recommend that you look into this course later in your computing studies.



Computing Similarity


Here is how similarity is computed using fuzzy set theory. Suppose we want to compute the similarity of two subscribers, sub1 and sub2.



  1. Compute the sum of all sub1's ratings, and the sum of all sub2's ratings. Call these sub1_sum and sub2_sum.

  2. Compute the intersection of sub1's ratings and sub2's ratings: for each music genre they have both rated, we choose theminimumof the ratings the two people gave that genre and we add up those minimum ratings. Call this intersection_sum.

  3. Compute intersection_sum/sub1_sumandintersection_sum/sub2_sum.

  4. The smaller of these two values is the similarity of p1 and p2



Example of Calculating Similarity



Given the following ratings between 1 and 10:


Sally: {“Country”: 2, “Rock”: 5, “Blues”: 3, “Hip-Hop”: 7}


Fred: {“Jazz”: 6, “Country”: 4, “Blues”: 2}


1. Find the sum of each of the subscriber’s ratings.



Sally: 17



Fred: 12


2. Sally and Fred both rated country and blues. To find the value of intersection_sum:min(2,4) +min(3,2) = 4 (the minimum of 2 and 4 is 2, similarly, the minimum of 3 and 2 is 2).


3. Compute intersection_sum/sub1sum and intersection_sum/sub2sum.


Sally: 4/17 Fred: 4/12


4. The smaller of these two values is the similarity of Sally and Fred.



4/17 is smaller, therefore, the similarity is 0.23


Something to think about: what would the similarity values of the two subscribers be if they gave the same rating on all of the same flavors?


Hint: the answer is 1!


As you can see, Fred and Sally are not very similar in their tastes of music.



Music Genres:


DJY Music would like to have channels for the following genres of music on their streaming service:


Jazz Country Rap


Blues Reggae Soul


EDM Hip Hop World


Rock Dance Funk


Pop Metal Easy Listening


Hits Opera Classical



Required Methods


Your program should include the following methods:



  • genre_similarity: this function accepts a dictionary of subscriber ratings and two subscriber names as its parameters. The function will return the similarity value for the two subscribers.

  • match_subscribers: this function accepts a dictionary of subscriber ratings and a subscriber name, custName, as its parameters. The function will return the name of the subscriber that is most similar to custName.

  • average_ratings: this function accepts a dictionary of subscriber ratings as its parameter and prints out the average rating for each genre of music. The average_ratings function should print the information out in an easy-to-read table in a format such as the following:



GENRE AVERAGE RATING



Country 22.5



Rock 37.6



Blues 15.4



  • most_popular: this function accepts a dictionary of subscriber ratings as its parameter and prints out the genre of music that is most popular based on the ratings assigned by subscribers.

  • recommend_genre: this function will accept a dictionary of subscriber ratings and the name of a subscriber as its parameters. The function will return a recommended music genre for the given subscriber. Here’s the approach for you to take in solving this part:

    • Find the subscriber who is most similar to the given subscriber (using the fuzzy set theory similarity measure described above).

    • From the music genres that the subscriber has rated that the given subscriber has not, choose and return the music genre with the highest rating. For example, suppose that a subscriber named Bob was matched with a subscriber named Maria. Bob's ratings are: {Country: 4, Rock: 7, Jazz: 3} Maria's ratings are: {Country: 2, Rock: 7, EDM: 5,Hip-Hop: 7}




We would recommend that Bob listen to Hip-Hop as Bob hasn't rated Hip-Hop and it's the genre that Maria rated the


highest (besides Rock, which Bob has already rated).



User Interface


The executive team at JMY Music will need a way of looking up the recommendations for a customer. Your program should provide a menu that will prompt the user for the name of a customer and the program should output all of the recommendations for the customer.



Demonstrating Functionality


In your program'smain() function, you should include unit testing code that demonstrates that your program and the functions that it includes work properly and produce the correct results based on the description in the assignment handout. Your main() function should:



  • prompt the user for a subscriber name and then displays the recommendations for that subscriber, if they can be made, using the recommend_genre function that you wrote.

  • display the average ratings for each of the music genres using the average_ratings function that you wrote.

  • display the name of the most popular genre using the most_popular function that you wrote.

  • prompt the user for a subscriber name and display the name of the subscriber(s) that is/are most similar to the given subscriber using the match_subscribers function that you wrote.



Modules


Your program should be organized using modules. I recommend a module for the functions related to similarity and recommendations, a module for the user-interface and a module for statistics.



Error Checking



  • When the user enters the name of a customer in the recommendation prompt, the program should verify that the customer is already in the dictionary. If the user is not, your program should print out a meaningful error message to the user and re-prompt for another customer name.



Starter Program


There is a starter program that you can use to help you get started with coding your solution. It is attached to this assignment description.



Important Details

All of your code MUST be encapsulated within functions. A "main" function will start the program execution. Solutions that are not written with functions will not receive a passing grade.


Your program must be well documented. Marks are allocated for documentation, neatly organized code, suitable variable names etc. Please refer to the program styling guide to see what we expect for proper documentation.


Aug 01, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here