User Tools

Site Tools



To understand recommender systems, and to have a significant, creative experience exploring a large dataset in a competition-style setting.


For this lab, you will construct a movie recommendation engine, using a simple publicly available dataset. For this lab, you will turn in three things:

  1. A notebook containing your code, but we will not run it.
  2. A set of predictions for a specific list of <user,movie> pairs, in a CSV file.
  3. A report discussing your approach, how well it worked (in terms of RMSE), and any visualizations or patterns you found in the data. PDF format, please!

We will run a small “competition” on your predictions: the three students with the best predictions will get 10% extra credit on this lab.

You may use any strategy you want to construct your predictions, except for attempting to determine the values of the missing entries by analyzing the original dataset.

Grading standards:

Your entry will be graded on the following elements:

  • 100% Project writeup
    • 35% Exploratory data analysis
    • 35% Description of technical approach
    • 30% Analysis of performance of method
  • 10% extra credit for the three top predictions


This lab is designed to help you be creative in finding your own way to solve a significant data analysis problem. You may use any of the techniques we have discussed in class, techniques from other classes, or you may invent your own new techniques.

The training set you will use can be downloaded here:

Movie ratings training data

You will need to make predictions for a set of user,movie pairs. These can be downloaded here:

Movie predictions data

A complete description of the data can be found in the readme.txt file. This dataset is richer than the Netflix competition dataset; for each movie, you also have a director and genre information, a corresponding IMDB ID, some RottenTomatoes information, as well as a set of tags that users may have used when rating each movie.

You should start by looking at the user_ratedmovies_train.dat file. It is a CSV file containing user,movie,timestamp tuples that form the core training data. Everything else is auxiliary data that may or may not be useful.

Turning in your submissions

As part of this lab, you must submit a set of predictions. You must provide predictions as a simple CSV file with two columns and 85,000 rows. Each row has the form

testID,predicted rating

The testID field uniquely identifies each user,movie prediction pair in the predictions set.

Evaluating your submissions

Performance of your prediction engine will be based on RMSE:

$$ \mathrm{RMSE} = \sqrt{ \frac{1}{N} \sum_{i} (\mathrm{prediction_i} - \mathrm{truth_i})^2 } $$

Note: it is strongly encouraged that you first partition your dataset into a training and a validation set, to assess the generalization performance of your rating algorithm!

Project writeup

Because you are being given full freedom in choosing your implementation strategy, you will not be graded on it (except to ensure that your implementation matches what you describe in your writeup!). Instead, you will be graded solely on a writeup describing your implementation.

This writeup must include three main sections:

  1. A discussion of your exploration of the dataset.
    1. Before you start coding, you should look at the data. What does it include? What patterns do you see?
    2. Any visualizations about the data you deem relevant
  2. A clear, technical description of your approach. This section should include:
    1. Background on the approach
    2. Description of the model you use
    3. Description of the inference / training algorithm you use
    4. Description of how you partitioned your data into a test/training split
  3. An analysis of how your approach worked on the dataset
    1. What was your final RMSE on your private test/training split?
    2. Did you overfit? How do you know?
    3. Was your first algorithm the one you ultimately used for your submission? Why did you (or didn't you) iterate your design?


import matplotlib.pyplot as plt
import seaborn
import pandas
ur = pandas.read_csv('user_ratedmovies_train.dat','\t')
plt.hist( ur['rating'] )
# create a test/train split
all_inds = np.random.permutation( range(0,len(ur)) )
test_inds = all_inds[0:85000]
train_inds = all_inds[85000:len(ur)]
ur_test = ur.iloc[ test_inds ]
ur_train = ur.iloc[ train_inds ]
cs401r_w2016/lab12.txt · Last modified: 2016/04/04 12:07 by admin