model for loan risk controll,i.e. score card
Project description
bbbrisk-bbb风控包
本代码由bbbdata为评分卡专门开发的小贷风控包 评分卡教程和本代码的使用说明请参考:https://www.bbbdata.com
Install and Upgrade · 安装与升级
Pip
pip install bbbrisk # to install
pip install -U bbbrisk # to upgrade
Key features · 主要功能
- 变量分箱与分析 例如变量自动分箱,如下:
bin_set = bins.autoBin(x, y,enum_var=['city','marital']) # 自动分箱,如果有枚举变量,必须指出哪些是枚举变量
bin_stat = bins.bin_stat(x,y,bin_set) # 统计各个变量的分箱情况
对单个变量使用自动分箱,如下:
bin_set = bins.merge.chi2(x,y,bin_num=5,init_bin_num=10) # 使用卡方分箱对变量进行分箱
bin_stat = bins.Bins(bin_set).binStat(x,y) # 统计分箱结果
对单个变量手动分箱,如下:
bin_set = [['-',0],[0,0.37],[0.37,1.2],[1.2,2],[2,'+']] # 手动设置变量的分箱
bin_stat = bins.Bins(bin_set).binStat(x,y) # 统计分箱结果
统计结果中就会打印出变量在各个分箱的badrate、iv值等
- 构建评分卡 设置好分箱后,就可以将数据构建构建评分卡,如下:
model,card = model.scoreCard(x,y,bin_set) # 构建评分卡
card.featureScore # 评分卡-特征得分表
card.baseScore # 评分卡-基础
model.w # 逻辑回归模型的变量权重
model.b # 逻辑回归模型的阈值
- 打印相关报告 例如打印阈值表、分数分布图等,如下:
thd_tb = report.get_threshold_tb(score,y,bin_step=10) # 阈值表
report.draw_score_disb(score,y,bin_step=10) # 分数分布
Documents · 文档
更新日志
- v1.0.0: 添加数据
- v1.0.0: 初步上传
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bbbrisk-1.0.1.tar.gz
(669.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
bbbrisk-1.0.1-py3-none-any.whl
(708.9 kB
view details)
File details
Details for the file bbbrisk-1.0.1.tar.gz.
File metadata
- Download URL: bbbrisk-1.0.1.tar.gz
- Upload date:
- Size: 669.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2caa3111d0753f8e69848d18c325afb569857cfb19a0151f09031e87ba5bc27e
|
|
| MD5 |
a328ed8d568878b1a4e14ca8d5eb314c
|
|
| BLAKE2b-256 |
abfd9548a891eeb923ba0b7e4fba5c9d7b853b8d85e3c6af0bccfec77ed4087d
|
File details
Details for the file bbbrisk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bbbrisk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 708.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47b9923ad1a5d9683c77e66ba2a5ccbab43005c38aad6bca0d59701f760bf82b
|
|
| MD5 |
a1162b3d0f235bcc4b173a43c04f6ae2
|
|
| BLAKE2b-256 |
cc76375cf0f6dc15a501dc85f1aa3379b10052b48405f37bd5cb524f541e4de6
|