python关联规则挖掘可视化_apriorib1-一个Python库,它实现了用于关联规则挖掘的平滑而简单的apriori。目前限制最多4个项目/交易。-Balaka Biswas New in t...

apriorib1是一个Python库,用于在交易数据上执行关联规则挖掘。该库展示了apriori算法的各个阶段,并限制每个交易最多4个物品。通过pip安装后,可以快速开始进行数据挖掘并查看不同阶段的项集DataFrame。欢迎贡献者提出改进并确保更新测试。
摘要由CSDN通过智能技术生成

作者:Balaka Biswas

### 作者邮箱:balaka2605@gmail.com

### 首页:https://github.com/BALaka-18/apriorib1

### 文档:None

### 下载链接

# apriorib1

apriorib1 is a Python library that applies the very famous unsupervised learning algorithm, apriori, for Association Rule Mining(ARM) on a dataset of transaction/purchase logs and shows the accepted association rules.

Currently, this version is limited to a maximum of 4 items in a certain transaction.

3ab15f8bb9893bce65ba8828b6ee3bd2.png

New in this version

Displays stage-wise final itemset as pandas DataFrames.

cbd9ead9b54d089db9f16773e018a399.png

Installation

Use the package manager pip to install apriorib1.

pip install apriorib1

Quick Start

from apriorib1 import Apriori

data = [['MILK', 'BREAD', 'BISCUIT'],

['BREAD', 'MILK', 'BISCUIT', 'CORNFLAKES'],

['BREAD', 'TEA', 'BOURNVITA'],

['JAM', 'MAGGI', 'BREAD', 'MILK'],

['MAGGI', 'TEA', 'BISCUIT'],

['BREAD', 'TEA', 'BOURNVITA'],

['MAGGI', 'TEA', 'CORNFLAKES'],

['MAGGI', 'BREAD', 'TEA', 'BISCUIT'],

['JAM', 'MAGGI', 'BREAD', 'TEA'],

['BREAD', 'MILK'],

['COFFEE', 'COCK', 'BISCUIT', 'CORNFLAKES'],

['COFFEE', 'COCK', 'BISCUIT', 'CORNFLAKES'],

['COFFEE', 'SUGER', 'BOURNVITA'],

['BREAD', 'COFFEE', 'COCK'],

['BREAD', 'SUGER', 'BISCUIT'],

['COFFEE', 'SUGER', 'CORNFLAKES'],

['BREAD', 'SUGER', 'BOURNVITA'],

['BREAD', 'COFFEE', 'SUGER'],

['BREAD', 'COFFEE', 'SUGER'],

['TEA', 'MILK', 'COFFEE', 'CORNFLAKES']]

# Testing the Apriori class

apr = Apriori(records=data,min_sup=2,min_conf=50)

df1,df2,df3,df4 = apr.show_as_df(stage=1),apr.show_as_df(stage=2),apr.show_as_df(stage=3),apr.show_as_df(stage=4)

print("VIEWING THE ITEMSET DATAFRAMES AT THE DIFFERENT STAGES :\nSTAGE 1\n{}\nSTAGE 2\n{}\nSTAGE 3\n{}\nSTAGE 4\n{}".format(df1,df2,df3,df4))

apr.checkAssc()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Copy from pypi.org

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值