资源简介
详解python实现FP-TREE进行关联规则挖掘
python3.2实现,可以生成每一步fp树的图片(需要安装PIL)

代码片段和文件信息
__author__ = ‘wei‘
from fpnode import fpnode
from treebuilder import treebuilder
class cpbtreebuilder(treebuilder):
def __init__(selfcpb):
self.cpb=cpb
self.items=self.getitems()
self.itemtable=self.getitemtable()
self.itemcount=self.getitemcount()
self.tree=self.growtree()
def getitems(self):
items=[]
for path in self.cpb:
for node in path:
if node[0] not in items:
items.append(node[0])
return items
def growtree(self):
#create root node
tree=fpnode(NoneNoneNoneself.addnode2itemtableisroot=True)
for path in self.cpb:
path_sorted=sorted(pathkey=lambda n:self.itemcount[n[0]]reverse=True)
tree.grow(path_sorted)
return tree
def getitemcount(self):
itemcount={}
for path in self.cpb:
for item in path:
itemcount.setdefault(item[0]0)
itemcount[item[0]]+=item[1]
return itemcount
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-05-26 13:56 FP-tree\
目录 0 2013-05-19 21:33 FP-tree\.idea\
文件 171 2013-05-16 21:21 FP-tree\.idea\encodings.xm
文件 355 2013-05-19 21:33 FP-tree\.idea\FP-tree.iml
文件 219 2013-05-16 21:21 FP-tree\.idea\misc.xm
文件 277 2013-05-16 21:21 FP-tree\.idea\modules.xm
目录 0 2013-05-16 22:29 FP-tree\.idea\scopes\
文件 143 2013-05-16 21:21 FP-tree\.idea\scopes\scope_settings.xm
文件 173 2013-05-16 21:21 FP-tree\.idea\vcs.xm
文件 4899 2013-05-16 21:21 FP-tree\.idea\workspace.xm
文件 1084 2013-05-23 16:31 FP-tree\cpbtreebuilder.py
文件 2590 2013-05-26 13:51 FP-tree\drawtree.py
文件 528 2013-05-26 13:56 FP-tree\example.py
文件 1696 2013-05-23 17:25 FP-tree\fpnode.py
文件 5018 2013-05-26 13:43 FP-tree\fptreemining.py
文件 1491 2013-05-26 13:40 FP-tree\node.py
文件 2996 2013-05-23 15:34 FP-tree\sample.py
文件 1455 2013-05-26 13:45 FP-tree\treebuilder.py
文件 1478 2013-05-22 17:45 FP-tree\util.py
目录 0 2013-05-26 13:52 FP-tree\__pycache__\
文件 2038 2013-05-23 16:31 FP-tree\__pycache__\cpbtreebuilder.cpython-32.pyc
文件 3860 2013-05-26 13:52 FP-tree\__pycache__\drawtree.cpython-32.pyc
文件 2640 2013-05-24 10:11 FP-tree\__pycache__\fpnode.cpython-32.pyc
文件 6619 2013-05-26 13:43 FP-tree\__pycache__\fptreemining.cpython-32.pyc
文件 2979 2013-05-26 13:42 FP-tree\__pycache__\node.cpython-32.pyc
文件 2092 2013-05-23 15:35 FP-tree\__pycache__\sample.cpython-32.pyc
文件 2800 2013-05-26 13:52 FP-tree\__pycache__\treebuilder.cpython-32.pyc
文件 2261 2013-05-22 17:45 FP-tree\__pycache__\util.cpython-32.pyc
相关资源
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
评论
共有 条评论