java HW 5

foooq55
JavaLab8.pdf

Lab 8

User-CF Recommender System – Part I 50 points

In this lab, we will focus on understanding the design of a user-based collaborative filtering

recommender system. Then we will implement half that design in this lab, and the other half in

the next lab.

System Description:

A user-based collaborative filtering (User-CF for short) recommender works by making use of the

similarities between users in a system. To recommend items for a specific user u, first User-CF finds the

n-most similar users to u. These are called the neighbors of u. Then, the items that ratings that were given

by the neighbors of u for the different items are used to generate recommendation scores for each item.

Finally, the m items with the highest recommendation scores are recommended to u. The number of

neighbors n, and the number of items m can vary based on the application in which the recommender is

used.

The overall flow of the user-based collaborative filtering recommendation process can be summarized in

these steps:

1. Read movie information from file

2. Read user information from file

3. Generate movie recommendations for each user as follows. For each user u:

a. Find u’s n most similar neighbors

i. Compute the Jaccard similarity between u and all other users

ii. Select the n users with the highest similarity values. Call these n users the

neighbors of u.

b. Compute movie recommendation scores for u as follows.

i. For each movie, compute its recommendation score using the rating information

for the neighbors of u.

ii. Select the m movies with the highest recommendation scores.

System Design:

1. The system will include a class named User to represent a user. That class should include the user’s

ID, name, number of watched items, and a list containing the IDs of the watched items. The class

should include a method for computing the number of similar items between two users.

2. To allow for representing diverse items, the system will include an abstract class named Item to

represent a generic item. This class will include the item’s ID, name and description.

3. To represent movie items, the system will include a class named Movie that inherits from the

abstract Item class. It will include the movie’s genre and director.

4. The system will contain a generic Recommender class that can be used to represent the

basic information and behavior of any recommender technique. Specifically, it will

contain the list of users, list of items, and an abstract method for generating

recommendations. This class is abstract.

5. The system will contain a more specific recommender class, UserCFRecommender, that

inherits from the generic Recommender class. It will contain methods that are specific

to this recommendation technique.

UML Diagram for the System Design:

Recall the meanings of the UML Symbols:

- Private

+ Public

# Protected

Lab Work:

1. You are provided with the java files containing all the class names along with the class variables

and the method definitions.

2. You are required to implement the class methods that are shown in Bold Red in the UML diagram

above.

3. The algorithm for each method is written, and commented, inside each method in the java files.

4. Don’t forget to implement a constructor for each class to initialize its data. Let your constructor

print a message indicating successful initialization of the object data.

5. In your main method, create a UserCFRecommender object, and use it to read the items and users

files. Then, print the user and item information to the console. The users and items files are also

provided with the lab materials.

6. Run your main function and make sure that it is properly reading the users and items information.

Lab Deliverables:

1. Zip all your code, along with a screen shot showing the output obtained after you compiled and

run your code.