Chapter 5 Application of Logistic Regression Model in the Development of Score Card

Application of Logistic Regression Model in the Development of Score Card

Course introduction: Logistic regression model is a commonly used algorithm in classification scenarios. It has the characteristics of simple structure, strong interpretability, and the output result is "soft classification". The scoring model mostly uses this kind of algorithm. At the same time, the logistic regression model also faces some limitations, so we made corresponding adjustments and constraints on the input features in the feature engineering stage.

table of Contents:

  • Basic concepts of logistic regression model
  • Construction of scorecard based on logistic regression model
  • Scaled

1. Basic concepts of logistic regression model

  • Bernoulli scheme

In the classification model, the target variable is a discrete and disordered variable. For example, the target variable (also called label) in the default prediction model is {default, non-default}. The linear regression model cannot model this type of label, because the value space of the result of the linear regression model is the entire real number space. For the classification model, the object we model is the probability of each category appearing on a certain sample .

Bernoulli scheme

An event has two mutually exclusive states: "occurrence" and "non-occurrence". Assuming that the probability of the event occurring is, the probability of not occurring is. We use 1 and 0 to indicate the occurrence or non-occurrence of the event, then:

Can be unified into

Logistic regression model and logistic transformation

In the default prediction scenario, the default event of a single individual can be regarded as a Bernoulli profile:

The parameter is the target we need to predict.

How to fit the probability?

The value range of probability is 0~1. As mentioned above, the value space of the target variable of linear regression is the entire real number space, so it is not suitable to use the linear regression model to make predictions. Introducing the following logistic transformation (also known as the sigmoid function), the value range of the objective function that can be fitted is limited to 0~1:

Logistic regression model and logistic transformation (continued)

specialty

  • Monotonicity, ie>
  • Boundedness, namely
  • Conductivity, that is

In addition, there is a computational advantage, namely

  • Logistic regression model and logistic transformation (continued)

Because the logistic transformation has the above-mentioned advantages, we apply the transformation to the characterization of probability:

Which respectively represent the value of p features and the weight of the feature on the i-th observation.

So the form of the entire logistic regression model is:

需要注意的是,这里的回归模型是对违约概率做回归,而非对违约结果{0,1}做回归。

  • 参数估计

通常用极大似然估计法(MLE)求出逻辑回归的参数

对于样本,逻辑回归模型的似然函和对数似然函数分别为

参数估计的结果是为了让似然函数最大化。由于对数似然函数与似然函数单调上升且具有更紧凑的形式,同时也易于求导运算,因此将似然函数最大化转化为对数似然函数最大化,即

对求偏导,结果是

显然,的方程是没有解析解的。

无法得到解析解的情况下,只能通过数值求解的方式来计算参数的估计。常用梯度上升法来迭代地计算。基本的算法步骤如下:

  1. 初设化参数和步长
  2. 计算当前梯度:
  1. 更新参数:
  1. 直至满足终止条件

注:

根据计算梯度使用的样本量的多少,梯度上升法分为批量梯度上升法、随机梯度上升法与小批量梯度上升法。

  • 逻辑回归模型的优点

结构简单:

  • 变量之间的关系是线性可加关系

可解释性高:

  • 结构简单;输入变量对目标变量的影响是容易获得的

支持增量训练:

  • 无需读入全部数据,可增量式地读取数据、训练模型

给出概率而非判别类别:

  • 模型的结果是估计出属于某一类的概率,可用于更加复杂的决策

工程化相对容易:

  • 模型的测试、部署、监控、调优等工作相对简单

逻辑回归模型的不足

预测精度一般

  •     由于模型结构较为简单,导致预测精度不如其他模型

对变量要求高

  •     输入变量需数值类型,需要对非数值变量进行编码
  •     不能容忍缺失值,需要对缺失值做处理
  •     对异常值敏感,需要对异常值做处理
  •     变量尺度差异较大时,容易对模型有影响,需要做变量归一化
  •     变量间的线性相关性对模型有影响,需要做变量挑选或加上正则项

2.基于LR模型的评分卡构建工作

逻辑回归模型对变量的要求

当用逻辑回归模型来构建评分卡时,入模变量需要满足以下条件

  1. 变量间不存在较强的线性相关性和多重共线性
  2. 变量具有显著性
  3. 变量具有合理的业务含义,即变量对于风控业务是正确的

其中,第1点已经在单变量分析与多变量分析中得到一定的约束,但是未必充分。

关于第2点,需要从系数的p值进行检验

关于第3点,需要从系数的符号进行检验

  • 变量显著性

为了获取与目标变量(即违约标签)有较高相关性的变量,我们要求最终入模的变量的系数的p值很小,例如低于0.1。如果发现模型中某些变量不显著,需要检验一下两种可能性:

  1. 该变量本身不显著
  2. 该变量显著,但是由于有一定的线性相关性或者多重共线性,导致该变量在多元回归下不显著

先检验1的可能性,如果排除,再检验2.

检验1的方法:

将该变量单独与目标变量做逻辑回归模型,如果在单变量回归的情况下系数的p值仍然较高,即表明该变量本身的显著性很低。

注:

对于IV较高的变量,1的可能性较低。

  • 变量正确性

在WOE的计算公式中,

当WOE为负时,表明当前箱的"危险性"高于平均样本的"危险性",出现坏样本的概率更高。因此在逻辑回归模型中,所有变量对应的系数应该为负。

反之,如果采取的WOE的计算公式为:

同理,所有变量对应的系数应该为正。

  • 逻辑回归模型对变量的要求(续)

  • 特征选择

从上述的单变量回归中可以发现,在full regression中,不显著、不正确的变量是由于线性相关性引起的。因此需要在做一次变量挑选。变量挑选的目的是为了满足:

  1. 入模变量正确并且显著
  2. 入模变量的"重要性"是最高的

其中,我们可以用IV来衡量入模变量的重要性。

综上,变量挑选的步骤如下:

  1. 将变量根据IV进行降序排列,不妨设为,其中""代表重要性的次序
  2. 当前的入模变量集合为{}
  3. 从剩余的变量中挑选第一个变量放入上一步的集合中,建立回归模型。如果该模型的所有的变量都满足p值小于阈值、系数为负,则在入模变量集合中保留该变量,否则剔除
  4. 遍历所有变量

  • 尺度化

得到符合要求的逻辑回归模型后,通常还需要将概率转化成分数。分数的单调性与概率相反,即分数越高表明违约的概率越低,信用资质越好。在评分卡模型中,上述过程称为"尺度化",转换公式为:

其中,, : point to double odds

PDO的作用

假设当前的好坏比为, 对应的分数为.

当好坏比上升一倍时变为2, 即=y-ln2, 此时分数变为

因此,PDO的含义即为,当好坏比上升1倍时,分数上升PDO个单位。

Base Point的选择

要满足所有的评分的取值为正。

Guess you like

Origin blog.csdn.net/weixin_42224488/article/details/109667120