Logo elodees  elodees

A caring AI for a better world













Only alphabetic characters accented or not as well as the space are accepted

Logo IA




Eclat algorithm





No account yet ?

Sign up to access all content




The ECLAT algorithm stands for "Equivalence Class Clustering and bottom-up Lattice Traversal".

This is one of the popular methods for extracting association rules.

It is a more efficient and scalable version of the Apriori algorithm.

Apriori algorithm




Tested in Anaconda and Python 3.7

# Importing the libraries
 
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
 
# Data Preprocessing
 
dataset = pd.read_csv('Market_Basket_Optimisation.csv', header = None)
transactions = []
for i in range(0, 7501):
  transactions.append([str(dataset.values[i,j]) for j in range(0, 20)])
 
# Training the Eclat model on the dataset
 
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)
 
# Visualising the results
results = list(rules)
 
print(results)
 
# Putting the results well organised into a Pandas DataFrame
 
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 = ['Product1', 'Product2', 'Support'])
 
resultsinDataFrame.nlargest(n = 10, columns = 'Support')
print(resultsinDataFrame)
 


ECLAT-algorithm - GitHub



Result



    Product1    Product2    Support
0light cream    chicken0.004533
1mushroom cream sauceescalope0.005733
2pastaescalope0.005866
3fromage blanchoney0.003333
4herb & pepperground beef0.015998
5tomato sauceground beef0.005333
6light creamolive oil0.003200
7whole wheat pastaolive oil0.007999
8pastashrimp0.005066





Data engineering


Deep learning

Machine learning












Welcome, my name is Eric Soupet and I am the administrator of the site elodees.com. elodees.com is a state of the art of Artificial Intelligence and aims to be collaborative, you can now offer content such as articles, events, tutorials, ... so don't hesitate !

Platform images credit : Pixabay - Pixabay License | Pexels - Pexels License