This is Part 4 of our “Analyzing the Movielens data” series.
In Part 3, we answered the following by building Juxt flows –
- List only the good movies – the ones that got an average rating of 4.3 or higher
In that example, we went over the select module to create custom filters.
Let’s build on that to address the next one
- What genres of movies do Programmers rate the most?
As always, let’s lay down the logical steps needed to address this
- Filter the data to include only the movies rated by Programmers (Occupation code =12)
- Group the filtered data by Genres.
- Iterate through each group and count the number of items in each of the buckets
- Sort the Genre buckets by the count and derive the top 10 genres
The data flow for this is shown below
We first filter the data set using the now familiar Select module with our custom filter. Again, the filter is a rather simple one here where we simply do a lookup for occupation and if it is equal to 12 which is the occupation code in the dataset for Programmers, we pass it through to the next stage of analysis.
The figure below shows the filter logic.
The next step is to group the filtered dataset into buckets of data by genres. This is done simply by using the Group By module with genres as the column to be grouped by. There are 294 genre combinations in the dataset. So, the Group By operation creates 294 buckets each of them containing the data belonging to that specific genre categorization.
Now we need to iterate through each of those buckets and count the number of records in the bucket. We do that with Collect module. Collect works very similar to Select. It takes in collection of data and performs the user (or template) logic in each of the items in the collection. One simply picks the user logic or Collector from the drop down menu.
Figure below shows the collector logic for our use case here. Here, we simply lookup each bucket, Count the number of entries and assign a name (key) to the result.
Top N module outputs the top 10 results sorted by count to an HTML table.
A two minute video of the discussion can be seen here