项目作者: amphibian-dev

项目描述 :
ESC Team's scorecard tools
高级语言: Python
项目地址: git://github.com/amphibian-dev/toad.git
创建时间: 2018-08-31T06:01:28Z
项目社区:https://github.com/amphibian-dev/toad

开源协议:MIT License

下载




TOAD

PyPi version
Python version
Build Status
Downloads Status

Toad is dedicated to facilitating model development process, especially for a scorecard. It provides intuitive functions of the entire process, from EDA, feature engineering and selection etc. to results validation and scorecard transformation. Its key functionality streamlines the most critical and time-consuming process such as feature selection and fine binning.

Toad 是专为工业界模型开发设计的Python工具包,特别针对评分卡的开发。Toad 的功能覆盖了建模全流程,从 EDA、特征工程、特征筛选 到 模型验证和评分卡转化。Toad 的主要功能极大简化了建模中最重要最费时的流程,即特征筛选和分箱。

Install and Upgrade · 安装与升级

Pip

  1. pip install toad # to install
  2. pip install -U toad # to upgrade

Conda

  1. conda install toad --channel conda-forge # to install
  2. conda install -U toad --channel conda-forge # to upgrade

Source code

  1. python setup.py install

Key features · 主要功能

The following showcases some of the most popular features of toad, for more detailed demonstrations and user guidance, please refer to the tutorials.

以下部分简单介绍了toad最受欢迎的一些功能,具体的使用方法和使用教程,请详见文档部分。

  • Simple IV calculation for all features · 一键算IV:
  1. toad.quality(data, 'target', indicators = ['iv'])
  • Preliminary selection based on criteria · 根据特定条件的初步变量筛选;
  • and stepwise feature selection (with optimised algorithm) · 优化过的逐步回归:
  1. selected_data = toad.selection.select(data,target = 'target', empty = 0.5, iv = 0.02, corr = 0.7, return_drop=True, exclude=['ID','month'])
  2. final_data = toad.selection.stepwise(data_woe,target = 'target', estimator='ols', direction = 'both', criterion = 'aic', exclude = to_drop)
  • Reliable fine binning with visualisation · 分箱及可视化:
  1. # Chi-squared fine binning
  2. c = toad.transform.Combiner()
  3. c.fit(data_selected.drop(to_drop, axis=1), y = 'target', method = 'chi', min_samples = 0.05)
  4. print(c.export())
  5. # Visualisation to check binning results
  6. col = 'feature_name'
  7. bin_plot(c.transform(data_selected[[col,'target']], labels=True), x=col, target='target')
  • Intuitive model results presentation · 模型结果展示:
  1. toad.metrics.KS_bucket(pred_proba, final_data['target'], bucket=10, method = 'quantile')
  • One-click scorecard transformation · 评分卡转化:
  1. card = toad.ScoreCard(
  2. combiner = c,
  3. transer = transer,
  4. class_weight = 'balanced',
  5. C=0.1,
  6. base_score = 600,
  7. base_odds = 35 ,
  8. pdo = 60,
  9. rate = 2
  10. )
  11. card.fit(final_data[col], final_data['target'])
  12. print(card.export())

Documents · 文档

Community · 社区

We welcome public feedback and new PRs. We hold a WeChat group for questions and suggestions.

欢迎各位提PR,同时我们有toad使用交流的微信群,欢迎询问加群。

Contributors

Contributors


Dedicated by The ESC Team