Commit 8d3de4ce authored by 舒皓月's avatar 舒皓月

加入VLM V 0.0.4, 2019 08 01

parent 04453ff3
tmp.py
test.py
.idea/
\ No newline at end of file
......@@ -16,7 +16,7 @@
# VLM
- 待重写.
- 重写完成, 代码流程改天写.
# PSI & Lift Chart
......@@ -49,9 +49,8 @@
- 某个客群是否异常(AUC明显下降, PSI较大).
- NOTE:
- 当某月样本量很小, 或者没有样本时, 标记为NaN. 对应的PSI, AUC也为NaN.
- 当某月样本量比较小, 导致PSI, AUC计算异常(如某些分箱没有样本, 全为非逾期样本), 则标记为-999.
- 基准月的PSI为其与全样本第一个月之间的PSI, 反应该客群与整体的差别.
- 基准月的AUCR为其与全样本第一个月AUC之间的比率, 反应该客群与整体之间的差别.
- 当某月样本量比较小, 导致AUC计算异常(如某些分箱没有样本, 全为非逾期样本), 则标记为-999.
- 对于PSI的计算, 采用平滑处理, 根据PSI计算公式, 一旦某箱为0, 而基准月该分箱只要不为0, 就会导致计算异常, 因此计算PSI时为每箱的占比在原基础上增加0.001, 使计算更加稳定.
## 使用方法
......@@ -60,7 +59,10 @@
- 创建一个模型监控对象(这样我们就有对象了^v^).
```python
mm = ModelMonitor(excel_path='./model_score.xlsx', sheet_name='mongo_model', save_path='./image/', passdue_day=15, num_month=4, min_user_group=500, max_psi=0.1, min_aucr=0.8, if_load=False, if_save=True)
# 创建对象.
mm = ModelMonitor(excel_path='./model_score.xlsx', sheet_name='mongo_model', save_path='./image/', passdue_day=15, num_month=4, min_user_group=1000, max_psi=0.1, min_aucr=0.9, if_read=True, if_save=True)
# 执行run方法.
mm.run()
```
- excel_path: Excel文件路径.
......@@ -85,19 +87,14 @@
- min_aucr: 最小AUCR, 小于则视为该客群异常.
- if_load: 是否从本地加载数据.
- if_read: 是否从数据库读取数据.
默认为False, 即从数据库抽取数据.
默认为False, 即从本地获取数据.
- if_save: 是否将数据库抽取的数据保存到本地.
- 执行run函数.
```python
mm.run()
```
- 输出:
## 输出
- 图片保存在./image中.
- PSI: ./image/PSI
......@@ -109,9 +106,7 @@
# TODO
- 添加对存在MySQL中模型分计算PSI, AUC的代码.
- 完成对VLM的重写.
- 部分(量信分, app模型)模型分报错, 进一步与模型维护者交流, 看是否字段名或者其它地方有问题.
- 对于某些客群在10个分箱中, 部分分箱数量为0导致计算异常的进行细致的处理.
- 增加模型重要特征的VLM.
# 版本信息
......@@ -138,6 +133,13 @@
- 增加数据读写模式的功能, 主要方便debug.
- V 0.0.4
- 删除基准月AUCR, PSI的计算.
- 重写VLM.
- 增加过滤空跑数据的功能.
- 增强代码鲁棒性.
# 贡献
- 王家华 (jiahua.wang@quantgroup.cn)
......
This diff is collapsed.
This diff is collapsed.
No preview for this file type
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment