Market basket anlaysis with two types of products with R

 2 I have two types of products, videos and sounds, and I want to understand which sounds are purchased often with which videos or sets of videos. Pretty much a market basket analysis but just one in which the lhs of the rules is only video products and the rhs only audio products. I'm using R and the package arules doesn't seem to have a good option to do this, does anyone know how to do this with R or one of its libraries. Else I'll have to mine simpler rules which would be a shame. Thanks asked 09 Jul '10, 17:49 Jorge Guzman 21●1●2 accept rate: 0%

 2 Sounds like you are trying to create a frequency or contigency matrix. Here is one approach table(myproductsdataframe$videoproduct, myproductsdataframe$audioproduct)  The 'myproductsdataframe' should be dataframe that has a video product and an audio product purchased in the same row. 'videoproduct' and 'audioproduct' are the column names of the dataframe. answered 09 Jul '10, 19:36 larrydag 1 ♦ 3.2k●6●13●26 accept rate: 9% Well, this would work for one to one maping but not of sets which where I think there would be real value to do this. For example, if you have two videos, ny and marvel comics, then it could suggest the spider man theme which could be a good fit even though not for either independently. Thanks for the reply! (12 Jul '10, 19:16) Jorchi
 2 The standard way to do this AFAIK is association rules. There is an apriori library in R called arules here http://cran.r-project.org/web/packages/arules/index.html Another option is a collaborative filtering based approach such as discussed in this paper http://cran.r-project.org/web/packages/recommenderlab/vignettes/recommenderlab.pdf where basic user/user and item/item cf are discussed answered 02 Aug '10, 09:23 iamreddave 1 21●2 accept rate: 0% yeah, I tried with apriori and I couldn't find how to force the video -> audio relationship. Maybe there is a way by I just don't know? (03 Aug '10, 13:47) Jorchi Apologies. When you answer questions with a massive hangover this can happen. We are looking for a way to say the right hand side of the arules rule must be a audio item (say). So a set of rules something like rulesA <- subset(rules, subset = rhs %in% "audio") where "audio" is either a vector of the right products audio=c('mariah','madonna') or it is another variable you have set to a 1 boolean value whenever the product is audio. I will have a monkey with the R syntax and get back to you. (03 Aug '10, 13:59) iamreddave
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×46
×5