Giter VIP home page Giter VIP logo

justinscorecard's Introduction

#########################################################################

Revised and enriched by JustinGao

#########################################################################

评分卡模型实现函数模块

author: JustinGao
modify_date: 2022-09-22

函数目录:

1. eda.py

  1. 变量的分布(可视化)
  • plot_cate_var -- 类别型变量分布
  • plot_num_col -- 数值型变量分布
  1. 变量的违约率分析(可视化):
  • plot_default_cate -- 类别型变量的违约率分析
  • plot_default_num -- 数值型变量的违约率分析

2. dataprocessing.py

  1. 缺失值处理
  • missing_cal -- 计算每个变量的缺失率
  • plot_missing_var -- 所有变量缺失值分布图
  • plot_missing_user -- 单个样本的缺失分析
  • missing_delete_var -- 缺失值剔除(针对单个变量)
  • missing_delete_user -- 缺失值剔除(针对单个样本)
  • fillna_cate_var -- 缺失值填充(类别型变量)
  • fillna_num_var -- 缺失值填充(数值型变量)
  1. 常变量/同值化处理
  • const_delete -- 常变量/同值化处理
  1. 降基处理
  • descending_cate -- 类别型变量的降基处理

3. Cluster.py

  • cluster_AffinityPropagation --#亲和力传播
  • cluster_AgglomerativeClustering --#聚合
  • cluster_Birch --#BIRCH
  • cluster_DBSCAN --#DBSCAN
  • cluster_KMeans --#K-Means
  • cluster_MiniBatchKMeans --#Mini-Batch K-Means
  • cluster_MeanShift --#均值漂移
  • cluster_OPTICS --#OPTICS
  • cluster_SpectralClustering --#光谱聚合
  • cluster_GaussianMixture --#高斯模糊

4.binning_funciton

  • iv_count -- 计算IV
  • get_var_median -- 关于连续变量的所有元素的中位列表
  • calculate_gini -- 计算基尼指数
  • get_cart_split_point -- 获得最优的二值划分点(即基尼指数下降最大的点)
  • get_cart_bincut --计算最优分箱切分点
  • calculate_chi --计算卡方值
  • get_chimerge_bincut --计算卡方分箱的最优分箱点
  • get_maxks_split_point --计算KS值
  • get_bestks_bincut --计算最优分箱切分点
  • bin_frequency --等频分箱
  • bin_distance --等距分箱
  • bin_self --自定义分箱

5.binning.py

  • binning_cate -- 类别型变量的分箱
  • iv_cate -- 类别型变量的IV明细表
  • binning_num -- 数值型变量的分箱(使用卡方分箱)
  • iv_num -- 数值型变量的IV明细表
  • binning_self -- 自定义分箱
  • plot_woe -- 变量woe的可视化
  • woe_monoton -- 检验变量的woe是否呈单调变化
  • woe_large -- 检验变量某个箱的woe是否过大(大于1),PS:箱体的woe在(-1,1)较合理

6.var_select.py

  • select_xgboost -- xgboost筛选变量
  • select_rf -- 随机森林筛选变量
  • plot_corr -- 变量相关性可视化
  • corr_mapping -- 变量强相关性映射
  • forward_delete_corr -- 逐个剔除相关性高的变量
  • forward_delete_corr_ivfirst -- 逐个剔除相关性高的变量(考虑IV大小)
  • forward_delete_corr_impfirst -- 逐个剔除相关性高的变量(考虑xgb或者rf)
  • forward_delete_pvalue -- 显著性筛选(向前选择法)
  • forward_delete_coef -- 逻辑回归系数符号筛选(每个变量的系数符号需要一致)
  • depth_first_search -- 暴力搜索特定组合的col_list的ks,并组建叠加变量数量

7.woe_discrete.py

  • woe_df_concat -- 变量woe结果明细表
  • woe_transform -- 变量woe转换

8.model_evaluation.py

  • plot_roc -- 绘制ROC曲线
  • plot_model_ks -- 绘制模型的KS曲线
  • plot_learning_curve -- 绘制学习曲线
  • cross_verify -- 交叉验证
  • plot_matrix_report -- 混淆矩阵/分类结果报告

9.model_implement.py

  • cal_scale -- 评分卡刻度
  • score_df_concat -- 变量score的明细表
  • score_transform -- 变量score转换
  • plot_score_ks -- 绘制评分卡的KS曲线
  • plot_PR -- PR曲线
  • plot_score_hist -- 好坏用户得分分布图
  • score_info -- 得分明细表
  • plot_lifting -- 绘制提升图和洛伦兹曲线
  • rule_verify -- 设定cutoff点,计算衡量指标

10.model_monitor.py

  • score_psi -- 计算评分的PSI
  • plot_score_compare -- 评分对比图
  • var_stable -- 变量稳定性分析
  • plot_var_shift -- 变量偏移分析

11.datamerchant_tools.py

  • weight_ks -- 计算加权之后的模型KS以及区间坏率

justinscorecard's People

Contributors

encyc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.