Home Eclat
Post
Cancel

Eclat

What is Eclat?

The Eclat model serves to review all combinations and tells you which ones to focus on.

The Eclat algorithm has only one part unlike Apriori:

  • Support
    It’s very similar to Bayes. Let’s assume that we are doing a movie recommendation.
$ support(M) = \frac{user\ watchinglists\ containing\ M}{user\ watchlists} $



Because Eclat doesn’t have “confidence” and “lift”, it makes no sense to look at an item by itself in the Eclat model.

The order of progression of eclat



  • Step 1.
    Set a minimum support.
  • Step 2.
    Take all the subsets in transactions having higher support than the minimum support.
  • Step 3.
    Sort the subsets by decreasing support.


Example



Code



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from apyori import apriori
rules = apriori(
                transactions = transactions, 
                min_support = 0.003, 
                min_confidence = 0.2, 
                min_lift = 3, 
                min_length = 2, 
                max_length = 2)

results = list(rules)

def inspect(results):
    lhs         = [tuple(result[2][0][0])[0] for result in results]
    rhs         = [tuple(result[2][0][1])[0] for result in results]
    supports    = [result[1] for result in results]
    return list(zip(lhs, rhs, supports))
    
resultsinDataFrame = pd.DataFrame(inspect(results), columns = [
                                                                'Product 1', 
                                                                'Product 2', 
                                                                'Support'])

resultsinDataFrame = resultsinDataFrame.nlargest(n = 10, columns = 'Support')                                                               



Result





Implementation

This post is licensed under CC BY 4.0 by the author.