Skip to main content

A package for association analysis using the ECLAT method.

Project description

pyECLAT

Unlike the a priori method, the ECLAT method is not based on the calculation of confidence and lift, therefore the ECLAT method is based on the calculation of the support together of the variables.

pyECLAT is a simple package for associating variables based on the support of the different items, together, of a dataframe.This method returns two dictionaries, one with the frequency of occurrence of the items together and the other with the support of the items together.

Install

Via pip

pip3 install pyECLAT

Via github

git clone https://github.com/jeffrichardchemistry/pyECLAT
cd pyECLAT
python3 setup.py install

Dependencies

numpy>=1.17.4, pandas>=0.25.3, tqdm>=4.41.1

How to use

This package has two dataframes as example, its possible to use:

from pyECLAT import Example1, Example2
ex1 = Example1().get()
ex2 = Example2().get()

The working dataframe should look like the one below. In this case, each line represents a customer's purchase at a supermarket.

0 1 2 3
0 milk beer bread butter
1 coffe bread butter NaN
2 coffe bread butter NaN
3 milk coffe bread butter
4 beer NaN NaN NaN
5 butter NaN NaN NaN
6 bread NaN NaN NaN
7 bean NaN NaN NaN
8 rice bean NaN NaN
9 rice NaN NaN NaN

This package works directly with a pandas dataframe without column's name. Example: Making your dataframe

import pandas as pd
dataframe = pd.read_csv('dir/of/file.csv', header=None)  

Run ECLAT method:

from pyECLAT import ECLAT
eclat_instance = ECLAT(data=dataframe, verbose=True) #verbose=True to see the loading bar

After getting eclat_instance, a binary dataframe is automatically generated, among other resources that can be accessed:

eclat_instance.df_bin   #generate a binary dataframe, that can be used for other analyzes.
eclat_instance.uniq_    #a list with all the names of the different items

eclat_instance.support, eclat_instance.fit and eclat_instance.fit_all are the functions to perform the calculations. Example:

get_ECLAT_indexes, get_ECLAT_supports = eclat_instance.fit(min_support=0.08,
                                                           min_combination=1,
                                                           max_combination=3,
                                                           separator=' & ',
                                                           verbose=True)

It is possible to access the documentation, as well as the description, of each method using:

help(eclat_instance.fit)
help(eclat_instance.fit_all)
help(eclat_instance.support)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyECLAT-1.0.0.linux-x86_64.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyECLAT-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file pyECLAT-1.0.0.linux-x86_64.tar.gz.

File metadata

  • Download URL: pyECLAT-1.0.0.linux-x86_64.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for pyECLAT-1.0.0.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 cc4d380274c4de00dcc9c9bdfa2a9ded7697a038177c3a2f2acdea7bec293c29
MD5 8acfd7d96a8ef076ab1ca45cd65cf63a
BLAKE2b-256 de3916b9405b42b1a345f517eb85042eab3584a9234cf99a8cccc2d5c9f5d4b6

See more details on using hashes here.

File details

Details for the file pyECLAT-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyECLAT-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for pyECLAT-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07d44c74d9aa9b51d18a711dd5c26f2fe5e6300c4c426bc5c034051d8120e9d7
MD5 8d650306b58145cc099604f78ce066e5
BLAKE2b-256 9de824093991371328f450195a97584e760cbfca4d0230d3b90d3228d4d2e0ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page