Problem Solving
Assignment-3
Data Mining (CSE4052)
1. What do you mean by mining frequent patterns associations and correlations?
Frequent Pattern Mining (Association Rule Mining) is an analytical process
that finds frequent patterns, associations, or causal structures from data sets
found in various kinds of databases such as relational databases,
transactional databases, and other data repositories.
2. How do you mining frequent pattern? Explain with example
Frequent patterns are item sets, subsequences, or substructures that appear in
a data set with frequency no less than a user-specified threshold. For
example, a set of items, such as milk and bread that appear frequently
together in a transaction data set is a frequent item set.
3. What are the criteria for the classification of frequent pattern mining?
Based on the completeness of patterns to be mined, it can mine the whole
collection of frequent itemsets, the closed frequent itemsets, and the maximal
frequent itemsets, provided a minimum support threshold.
4. Why do we need Apriori algorithm for frequent pattern mining?
To improve the efficiency of level-wise generation of frequent itemsets, an
important property is used called Apriori property which helps by reducing
the search space. All subsets of a frequent itemset must be frequent (Apriori
property). If an itemsets is infrequent, all its supersets will be infrequent.
5. What are the applications of pattern mining?
Pattern mining has been used for the analysis of sequence or structural data
including trees, graphs, subsequences, and networks. In software
engineering, researchers have coherent consecutive or gapped subsequences
in code execution as sequential patterns that supports identify software
errors.
6. What is market basket analysis used for?
Market basket analysis is a data mining technique used by retailers to
increase sales by better understanding customer purchasing patterns. It
involves analyzing large data sets, such as purchase history, to reveal product
groupings, as well as products that are likely to be purchased together.
7. What is frequency pattern analysis?
A pattern frequency analysis compares the regular expression patterns found
in the values for the specified field and performs a frequency analysis based
on the patterns found. It creates a report for each field that lists each pattern
along with the number of times each pattern occurs.
8. What are the limitations of Apriori algorithm?
Apriori algorithm suffers from some weakness in spite of being clear and
simple. The main limitation is costly wasting of time to hold a vast number of
candidate sets with much frequent itemsets, low minimum support or large
itemsets.
9. What is the purpose of market basket analysis?
The purpose of market basket analysis is to determine what products
customers purchase together; it takes its name from the idea of customers
throwing all their purchases into a shopping cart (a “market basket”) during
grocery shopping.
[Link] the following given Transaction Data-set, Generate Rules using Apriori
Algorithm. Consider the values as Support=50% and Confidence=75%
Answer:
Given Support=50% and Confidence=75%
Step 1) Find Frequent Item Set and their support
Step 2) Remove all the items whose support is below given minimum
support.
Item Frequency Support (in %)
Bread 4 4/5=80%
Cheese 3 3/5=60%
Juice 4 4/5=80%
Milk 3 3/5=60%
Step 3) Now form the two items candidate set and write their
frequencies.
Step 4) Remove all the items whose support is below given minimum
support
Step 5) Generate rules
For Rules we consider item pairs: a) (Bread, Juice) Bread->Juice and Juice->Bread b)
(Cheese, Juice) Cheese->Juice and Juice->Cheese
Confidence (A->B) = support (AUB)/support (A)
Therefore,
1. Confidence (Bread->Juice) = support (Bread U Juice)/support (Bread) = 3/5 *
5/4=3/4= 75%
2. Confidence (Juice->Bread) = support (Juice U Bread)/support (Juice) =
3/5*5/4=3/4=75%
3. Confidence (Cheese->Juice) = support (Cheese U Juice)/support (Cheese)
=3/5*5/3=1=100%
4. Confidence (Juice->Cheese) = support (Juice U Cheese)/support (Juice) =
3/5*5/4=3/4=75%
All the above rules are good because the confidence of each rule is greater than or
equal to the minimum confidence given in the problem.
11. What are the different types of market basket analysis in Data Mining?
1. Descriptive market basket analysis: This type only derives insights from
past data and is the most frequently used approach. The analysis here does
not make any predictions but rates the association between products using
statistical techniques. For those familiar with the basics of Data Analysis,
this type of modeling is known as unsupervised learning.
2. Predictive market basket analysis: This type uses supervised learning
models like classification and regression. It essentially aims to mimic the
market to analyze what causes what to happen. Essentially, it considers
items purchased in a sequence to determine cross-selling. For example,
buying an extended warranty is more likely to follow the purchase of an
iPhone. While it isn't as widely used as a descriptive MBA, it is still a very
valuable tool for marketers.
3. Differential market basket analysis: This type of analysis is beneficial for
competitor analysis. It compares purchase history between stores, between
seasons, between two time periods, between different days of the week, etc.,
to find interesting patterns in consumer behaviour. For example, it can help
determine why some users prefer to purchase the same product at the same
price on Amazon vs Flipkart. The answer can be that the Amazon reseller
has more warehouses and can deliver faster or maybe something more
profound likes user experience.
12. For the following given transaction data set, generate rules using Apriori
Algorithm. Consider the values as Support=22% and Confidence= 70%
Answer:
Given minimum support=22% and confidence=70%
Step 1) Find Frequent Item Set and their support
Step 2) Remove all the items whose support is below given minimum support
and form the two items candidate set and write their frequencies.
Step 3) Remove all the items whose support is below given minimum support
and form the three items candidate set and write their frequencies
Step 4) Generate rules and find the confidence of each rule. If the confidence
is below 70% then discard that rule. Keep only the rules whose confidence is
equal to or above 70%.
Confidence (A->B) = support (AUB)/support (A)
For the item set (I1, I2, I3) following rules are possible:
For the item set (I1, I2, I5) following rules are possible:
Rule Confidence
(I1,I2)-> I5 2/9*9/4=2/4=50%
(I1,I5)-> I2 2/9*9/2=2/2=100%
(I2,I5)-> I1 2/9*9/2=2/2=100%
I1-> (I2,I5) 2/9*9/6=2/6=33.33%
I2-> (I1,I5) 2/9*9/7=2/7=28.57%
I5->(I1,I2) 2/9*9/2=2/2=100%
From above rules only following rules are valid (because it’s
confidence>=75%):
(I1, I5)-> I2
(I2, I5)-> I1
I5-> (I1, I2)
13. Assume min. Support ort = 40%
Marks: 10 M
Year: Dec 2015
TID Items
01 A,B,D,E
02 B,C,D
03 A,B,E
04 B,D
05 A,B,C,E
Answer:
Support count = 40%
X/5 * 100 = 50
x=3
Step 1: Generating 1-itemset frequent pattern
Scan D for count of each candidate
C1
Item Set Support Count
{A} 3
{B} 5
{C} 3
{D} 2
{E} 3
Compare candidate support count with minimum support count
L1
Item Set Support Count
{A} 3
{B} 5
{D} 3
{E} 3
Step 2: Generate C2- item set Frequent Pattern
Generate C2 candidate from L1
C2
Item Set Support Count
{A,B} 3
{A,D} 1
{A,E} 3
{B,D} 3
{B,E} 3
Compare candidate support count with minimum support count
L2
Item Set
{A, B}
{A,E}
{B, D}
{B,E}
Step 3: Generating 3- item set Frequent Pattern
C3
Item set Support Count
{A,B,E} 2
{A,B,D} 1
{A,E,B,D} 1
Compare candidate support count with minimum support count.
As the support count generated is less than minimum support count. So, there is no
item set with minimum support count.