Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To be implemented in Python. Dataset looks like this in the csv file: userID placeID rating U1001 H132830 2 U1001 H132825 3 U1001 H135085 1

To be implemented in Python.

image text in transcribed

Dataset looks like this in the csv file:

userID placeID rating
U1001 H132830 2
U1001 H132825 3
U1001 H135085 1
U1001 H135040 2
U1001 H135039 2
U1001 H135045 2
U1001 H135033 2
U1001 H135025 3
U1001 H135051 2
U1002 H132921 3
U1002 H135062 2
U1002 H135106 2
U1002 H132825 3
U1002 H135052 2
U1002 H132862 3
U1002 H135059 2

Not all entries but you get the idea.

Answer the below recommender systems related questions using the provided ratings dataset (a) For a given user, Ui, estimate the rating for the provided place, Pi, based on the ratings of the k-nearest neighbors who rated that place (i.e., first filter other users based on whether they already rated place P, then identify the k-nearest neighbors from the filtered list). If U; already rated P, then simply return the U;'s rating for Pi. Some tips on the implementation, sample function call and the expected outputs are provided below. # HINT: first generate the pivot table, then calculate distances for knn # de = pd.read_csv ("ratings_data.csv") # df_matrix df.pivot (index = "userID", columns = "placeID", values - "rating ").fillna (0) pred_rating, list_nsimilar_users getPredictedRatings_knn ("ratings_data.csv", user, place, n_neighbors=2) # e.g., for user = "U1001", place "H135080", pred_rating: 1.5, list_nsimilar_users: ['01073', '41057'] = (b) Provide a python function that implements SVD and returns a given number of recommendations along with their estimated ratings for a given user ID. Estimated ratings should NOT be fractional values and can only be one of the following values: 1.0, 2.0, 3.0. That is, you are required to post-process the SVD results to obtain logical estimated ratings (e.g. round to nearest integer). Sample function call and the expected outputs are provided below. dic_place_rating = get RecommendedPlaces_SVD ("ratings_data.csv", "U1077", num_recommendations=3) # dic_place_rating: # {'1132825': 3.0, '1135085': 2.0, '1135038' : 2.0} 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Who is your hero?

Answered: 1 week ago

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago