Analyzing Movielens Data Part 2

This is Part 2 of our “Analyzing the Movielens data” series.

In Part 1, we did the following:

  • reviewed the organization of the data
  • outlined a set of questions we’d like to ask
  • created Juxt workflows to integrate the data from three different data sources

Now, let’s look at a couple of the questions.

  1. What is the average rating for each movie broken down by gender?
  2. What are the top 10 movies that men rate higher than women?

Average Rating by Gender

We start by fetching from the user DB, where we have already integrated the Users, Movies and Ratings data. This is done with the Fetch from User DB module using the key “movielens-dataset”.

Juxt flow for calculating average ratings by gender
Juxt flow for calculating average ratings by gender

Average rating by gender can be computed using the built-in Pivot Table library module. Since we want the average Ratings, we set the Value property to “rating” and the Aggregation property to “mean”. We Group By the “title”, and split the “gender” Column values into new columns.

Finally, we render the results as a HTML Data Table, which is as follows:

Average ratings by gender
Average ratings by gender

Top 10 Movies that Men rate higher than Women

Now that we have the average ratings by gender, we can do the following:

  1. Calculate the difference in ratings from men and women for each movie
  2. Sort the movies in descending order by the difference in ratings
  3. Take the top 10
Ratings Difference by Gender
Ratings Difference by Gender

The Calculate New Column module adds a new column to the dataset based on an expression we specify. The expression can be any mathematical equation which references existing columns. In this case, we simply subtract the mean ratings to create a new column “difference”

rating-mean_gender_M - rating-mean_gender_F

The module Top N with Feature of “difference” and a Count of 10, will give us the top 10 movies with the most difference in ratings.

And the results are in:

Ratings Difference by Gender
Ratings Difference by Gender

Please check out our screencast of building these workflows in Juxt.io:

Analyzing Movielens Data Part 1

This might be familiar – a perennial question that keeps coming up in our home – What movie to watch tonight?

There’s a ton of movie ratings from actual users in the Movielens dataset. Wouldn’t it be great to use all this data to help us pick the right movie everytime?
We’ll use a Movielens dataset that contains 1,000,209 anonymous ratings of 3,900 movies made by 6,040 MovieLens users. – data explained here

From this, let’s say we want to ask the following –

  1. What is the average rating for each movie broken down by gender
  2. List only movies that received at least 100 ratings
  3. Of those, list only the good ones – movies that got ratings of 4.3 or higher
  4. List the top 10 movies that, on average, men rate higher than women
  5. What genres of movies do programmers like?

Organization of Data

The data is distributed across three disparate data stores.

Movie data is in a Comma Separated Value (CSV) file in Amazon S3. This contains MovieID, Title and Genres

Users data is in a CSV file in Dropbox data store. This contains UserID, Gender, Age, Occupation and Zip-code

Ratings data is in a Relational Database table in PostgreSQL that contains UserID, MovieID, Rating and a Timestamp

Data Integration

Since the data is spread across multiple silos (Amazon S3, Dropbox) and multiple formats (CSV, PostgreSQL), we need to combine the relevant data into a form that is easier to work with.

In the figure below, functional modules are wired together to create the data integration. At a high level:

  • We load the data from the different sources
  • Combine them (Join) based on a common feature or column to create a virtual data source (user-id for ratings & users, movie-id for movies)
  • The combined data is stored in a user DB (in-memory cache) with the ID “movielens-dataset”. This can be fetched in subsequent modules for further analytics
Data Import Flow
Data Import Flow

Please check out the video version of the data integration

In the next post, we will get into building the flows needed to answer the questions we started with.

Introducing the Juxt Data Workbench

Juxt is an interactive data workbench in the cloud that enables business users to build sophisticated data applications without writing any code. Similar to how you would describe a process on a whiteboard, i.e., identifying the steps needed and sequencing them into a complete end-to-end flow, Juxt lets you build data apps. For example – send promo email offers to a target set of customer profiles based on past behavior, forecast product demand based on seasonal trends.

Juxt - an Interactive Data Workbench
Juxt – an Interactive Data Workbench

In Juxt, you can create apps by dragging functional blocks from our component library onto a design canvas, wire them together and press the “Run” button. Our built-in component library includes connector blocks for various data sources & types, components for data munging, augmentation & aggregation, statistical & predictive machine learning algorithms, and web API’s to popular online services.

Explore, Integrate and Operationalize Data
Explore, Integrate and Operationalize Data

You can also build your own functional blocks using Juxt’s built-in library components or wrap existing R, Python, Javascript & Clojure code assets. This is huge, because all the interesting work you’ve already done can start being applied across your company right away. Every block that you create becomes usable in all your projects and across your entire organization. Wheel reinvention problem … solved!

Once you’re done creating your cool data app, publish it and show your peers & users what a rockstar you are!!