A package to compute weight of evidence (WOE) and Information Value (IV) easily, with cross-features supported
Project description
使用指南
安装
可以选择通过setup.py安装或者通过pip安装
cd fastiv
python setup.py install
或者
pip install fastiv
使用
FastIV支持便捷的Information Value (IV)计算,同时也支持交叉特征的计算。IV计算是通过使用决策树的方式,确定最终分箱的方法,从而计算出相应的IV值。
通过使用交叉的方式,可以确定组合特征的IV值,从中可以选出更有效的特征,加入到模型中。这一方法的思想,借鉴于第四范式的“AutoCross”。其中特征之间的交叉过程,
是通过决策树的分裂来实现的。
同时,我们提供了将决策树按照一定格式输出的接口,可以方便的将分裂节点打印出来。使用该包的调用代码示例:
from fastiv import FastIV
fiv = FastIV(criterion="entropy",
min_samples_leaf=50,
max_leaf_nodes=8,
others_threshold=200)
# 选择要交叉的特征
features = ['feature1', 'feature2']
# 计算iv和iv_dict
iv, iv_dict = fiv.fast_iv(df[features], y)
# 以DataFrame格式输出分箱情况
df_export = fiv.export(mode="df")
# 输入特征,返回所属箱对应的节点索引
bins = fiv.transform(df[features].values)
完整的代码可以参考example.py
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
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
File details
Details for the file FastIV-0.1.tar.gz.
File metadata
- Download URL: FastIV-0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae65e70aa093477055a1c4bceacc4edc4cb517853d702457bc4147228c3101a8
|
|
| MD5 |
f0aa1325d20e5729548465316b8abf6e
|
|
| BLAKE2b-256 |
e9c4b5a7d7ccb07e710c4a694376efd3531bfb4d5a0087c82a8cd3e845e523f2
|
File details
Details for the file FastIV-0.1-py3-none-any.whl.
File metadata
- Download URL: FastIV-0.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b28a3faf3c1c28771b02e1714553b9fd720be35d3ddbfd3db172095ea580d6d
|
|
| MD5 |
2e218066395eb51c3dbd55d63c991c03
|
|
| BLAKE2b-256 |
1171693608cb0e45111ee6683ee8d2a71743e01f0a6daafc0fd8ef96db13ff5a
|