library(tidyverse)
library(rmarkdown)
library(arules)
library(arulesViz)
library(plotly)Classwork 11
Association Rules with Music Data
Setup
π§ Load the Music Transaction Data
path_music <- "https://bcdanl.github.io/data/music_old.tsv"
music_eg <- read.transactions(
file = path_music,
format = "single",
header = TRUE,
cols = c(1, 2),
rm.duplicates = TRUE
)1οΈβ£ Column and Row Labels
Question 1
What do the labels for the column and the row of music_eg represent?
2οΈβ£ Transaction Sizes
Question 2a
What are the first quartile, the median, the third quartile, and the maximum of transaction sizes in music_eg?
Question 2b
Visualize the distribution of transaction sizes.
3οΈβ£ Item Frequencies
Question 3a
- Find the top 50 most frequently occurring items in
music_eg.
- Also find the top 50 least frequently occurring items in
music_eg.
Question 3b
Visualize the distribution of item occurrence.
4οΈβ£ Association Rules
Before finding association rules, we subset the data to transactions with more than one artist.
basket_sizes <- size(music_eg)
musicbaskets_use <- music_eg[basket_sizes > 1]Question 4a
From the subset of music_eg whose transaction size is greater than 1, find association rules with minimum support 0.01 and minimum confidence 0.5.
Question 4b
Pick one rule from Question 4a. Interpret the following qualities of the rule you pick:
- support
- confidence
- coverage
- lift
- count
Question 4c
Find at least 5 association rules for the item you pick by setting appropriate levels of minimum support and minimum confidence.
Discussion
Welcome to our Classwork 11 Discussion Board! π
This space is designed for you to engage with your classmates about the material covered in Classwork 11.
Whether you are looking to delve deeper into the content, share insights, or have questions about the content, this is the perfect place for you.
If you have any specific questions for Byeong-Hak (@bcdanl) regarding the Classwork 11 materials or need clarification on any points, donβt hesitate to ask here.
All comments will be stored here.
Letβs collaborate and learn from each other!