Institute of Computer Science
  1. Courses
  2. 2015/16 spring
  3. Data Mining (MTAT.03.183)
ET
Log in

Data Mining 2015/16 spring

  • Course Home
  • Lectures
  • Projects
  • Homeworks
    • Submit
  • Software
  • Links

...

HW06 (20.03) - Association rules, 2x2 tables, interestingness...

1. Construct an FP-tree using the same data set as last week (use the support count threshold smin = 2). Explain all the steps of the tree construction and draw a resulting tree. Based on this tree answer the questions: how many transactions contain {E,F} and {C,H} ?

B C A F H
F E C H
E D B
A C H F 
E F A
D H B
E C F B D 
A H C E 
G A E
B H E

2. Evaluate various interestingness measures for association rules. Generate randomly a broad range of various 2x2 contingency tables (f11, f10, f01, f00) for N=10,000 items. Sample the space so that each cell individually, in pairs, or triples is larger than "others". In this way sample at least 10,000 different possible contingency tables. Calculate 5 various scores based on those data (feel free to select) and report 10 top 2x2 tables that are the "best" according to that measure. Use rows to represent the 4 numbers; and if useful, also the marginal sums and N.

3. Compare interestingness measures starting from various fixed examples of (f11, f10, f01, f00) and experimenting with each of the four values - by increasing or decreasing it, one at a time.

E.g. starting from (250, 250, 250, 250) or ( 200, 200 , 200 , 400 ), make X axis on f11 and varying f11 from 0 to 1000, and Y axis the respective interestingness measure. Likewise, for other fields f10, f01, f11 you can do the same - varying them around that fixed value adding ( -100,-99,...,-1,0,+1,+2,...+100 ) or from 0 to 1000, while keeping the other values intact (N will change, obviously). Try plotting one score on one scatterplot while varying each of the fields fii independently from others. Explore 4-5 various measures.

4. Install R packages arules and arulesViz

install.packages("arules")
install.packages("arulesViz")

Get the Titanic survival data from https://courses.cs.ut.ee/MTAT.03.183/2014_spring/uploads/Main/titanic.txt

Make sure to explore all these commands, vary parameters, read the manual ... Try to vary them to provide nice interpretable outputs. See also 6. and 7.

# Make a note where your data lies ... 
titanic <- read.table( "data/titanic.txt", sep = ',' , header = TRUE)

#observe the data
##first 6 observations
head(titanic)
#types of features
str(titanic)
#dimensionality of the data
dim(titanic)

#load package for frequent set mining
library(arules)

#help with apriori
?apriori

#run apriori algorithm with default settings
rules = apriori(titanic)

#inspection of the result
inspect(rules)

#now let us assume, we want to see only those rules that have rhs as survived:
rules = apriori(titanic,appearance = list(rhs=c("Survived=No", "Survived=Yes"),default="lhs"))
inspect(rules)

#let us relax the default settings for the rules we are looking for
rules = apriori(titanic,parameter = list(minlen=2, supp=0.05, conf=0.8),appearance = list(rhs=c("Survived=No", "Survived=Yes"),default="lhs"))

#visualization
library(arulesViz)
plot(rules, method="graph", control=list(type="items"))

5. Report clearly the most "interesting" rules discovered from Titanic data, and how you came up with those in R.

6. (Bonus, 2p) Continue exploring various interestingness measures - ho to describe them the best, using perhaps the scatterplots measuring the effect of each field in the 2x2 tables. (e.g. how would symmetry look like, or other properties).

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment