监视pandas或spark数据集的稳定性
popmon的Python项目详细描述
popmon是一个允许检查数据集稳定性的包。 popmon可以同时使用pandas和spark数据集。在
popmon创建时间切片中的特征直方图, 并对其剖面和分布的稳定性进行了比较 这些柱状图使用统计检验,随着时间的推移和参照物。 它可以处理数字、顺序和范畴特征,并且直方图可以是更高维的,例如,它还可以跟踪任意两个特征之间的相关性。 popmon可以自动标记并在观察到的变化时发出警报,例如 作为趋势、变化、峰值、异常值、异常、变化的相关性等, 使用监控业务规则。在
文件
完整的popmon文档(包括教程)可以在read-the-docs找到。在
笔记本电脑
Tutorial | Colab link |
---|---|
Basic tutorial | |
Detailed example (featuring configuration, Apache Spark and more) | |
Incremental datasets (online analysis) |
看看吧
popmon库需要python3.6+,并且是pip友好的。要开始,只需执行以下操作:
$ pip install popmon
或者从我们的GitHub存储库中查看代码:
^{pr2}$在本例中,代码以编辑模式安装(选项-e)。在
现在,您可以使用Python中的包:
importpopmon
恭喜你,你现在可以使用popmon库了!
快跑
举个简单的例子,您可以:
importpandasaspdimportpopmonfrompopmonimportresources# open synthetic datadf=pd.read_csv(resources.data('test.csv.gz'),parse_dates=['date'])df.head()# generate stability report using automatic binning of all encountered features# (importing popmon automatically adds this functionality to a dataframe)report=df.pm_stability_report(time_axis='date',features=['date:age','date:gender'])# to show the output of the report in a Jupyter notebook you can simply run:report# or save the report to filereport.to_file("monitoring_report.html")
要指定自己要报告的binning规范和功能,请执行以下操作:
# time-axis specifications alone; all other features are auto-binned.report=df.pm_stability_report(time_axis='date',time_width='1w',time_offset='2020-1-6')# histogram selections. Here 'date' is the first axis of each histogram.features=['date:isActive','date:age','date:eyeColor','date:gender','date:latitude','date:longitude','date:isActive:age']# Specify your own binning specifications for individual features or combinations thereof.# This bin specification uses open-ended ("sparse") histograms; unspecified features get# auto-binned. The time-axis binning, when specified here, needs to be in nanoseconds.bin_specs={'longitude':{'bin_width':5.0,'bin_offset':0.0},'latitude':{'bin_width':5.0,'bin_offset':0.0},'age':{'bin_width':10.0,'bin_offset':0.0},'date':{'bin_width':pd.Timedelta('4w').value,'bin_offset':pd.Timestamp('2015-1-1').value}}# generate stability reportreport=df.pm_stability_report(features=features,bin_specs=bin_specs,time_axis=True)
这些示例也适用于spark数据帧。 您可以看到这样的示例笔记本代码here的输出。 有关所有可用的示例,请参见tutorialsat read the docs。在
资源
演示文稿
^{tb2}$文章
^{3}$项目贡献者
这个包是由ING批发银行高级分析编写的。 特别感谢为这个包的开发做出贡献的以下人员:Ahmet Erdem,Fabian Jansen,Nanne Aben,Mathieu Grimal。在
许可证
版权所有ING WBAA。popmon是完全免费的、开源的,并在MIT license下获得许可。在
- 项目
标签: