Skip to main content

BehaviorTool是一个Python包,提供了CombinePattern、ContinuePattern和SequencePattern三个类的实现行为模式挖掘。

安装

你可以使用pip安装BahaviorPattern:

pip install BehaviorPattern

使用

在你的Python代码中引入类,例如:

from BehaviorPattern. import CombinePattern, ContinuePattern, SequencePattern

#--------------------------------- 组合行为模式挖掘 ---------------------------------#
use_behavior = []
del_behavior = []
# 创建实例
behavior = CombinePattern.Generate(data=data, 
                                   use_behavior=use_behavior, 
                                   del_behavior=del_behavior, 
                                   min_support=0.1, 
                                   min_confidence=0.5, 
                                   min_length=3, 
                                   max_length=7, 
                                   sep='@') 
# 运行模型,返回pattern结果和使用的行为列表
combine, combine_use_behavior = behavior.run() 
# 筛选lift符合要求的pattern
combine_result = combine[combine['lift'] > 6] 


#--------------------------------- 连续行为模式挖掘 ---------------------------------#
use_behavior = []
del_behavior = []
# 创建实例
behavior = ContinuePattern.Generate(data=data, 
                                    use_behavior=use_behavior, 
                                    del_behavior=del_behavior, 
                                    min_support=0.1, 
                                    min_length=3, 
                                    max_length=6, 
                                    sep='@') 
# 运行模型,返回pattern结果和使用的行为列表
continues, continue_use_behavior = behavior.run() 
# 筛选lift符合要求的pattern
continues_result = continues[continues['lift'] > 6] 


#--------------------------------- 序列行为模式挖掘 ---------------------------------#
use_behavior = []
del_behavior = []
# 创建实例
behavior = SequencePattern.Generate(data=data, 
                                    use_behavior=use_behavior, 
                                    del_behavior=del_behavior, 
                                    min_support=0.1,
                                    min_length=3, 
                                    max_length=7, 
                                    sep='@') 
# 运行模型,返回pattern结果和使用的行为列表
sequence, seq_use_behavior = behavior.run() 
# 筛选lift符合要求的pattern
sequence_result = sequence[sequence['lift'] > 6] 

依赖

BehaviorPattern依赖以下Python库:

  • numpy
  • pandas
  • efficient_apriori
  • tqdm
  • prefixspan

完整的依赖列表可以在setup.py中找到。

贡献

如果你发现任何bugs,请提交Issue或Pull Request进行更正

作者

BehaviorPattern由Chen Chen编写和维护。

Metadata

Release files for BehaviorPattern 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BehaviorPattern 0.0.8
File Size Uploaded
BehaviorPattern-0.0.8.tar.gz 4.8 kB Details

Release files / BehaviorPattern-0.0.8.tar.gz

Download URL BehaviorPattern-0.0.8.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9091330b22c3b3366a736df2a16c761b8af4be5fcf35095b7aba04296c58dd4d
BLAKE2b-256 checksum
How to use checksums
62352b91dbcd8fbfe711ffdd7812986e24211429ba855d272f2fcbf23cef33a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.0.8 This release

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page