我正在使用逻辑回归和随机森林对贷款违约概率进行分析。
当我使用逻辑回归时,预测始终为“1”(这意味着良好的贷款)。我以前从未见过这种情况,也不知道从哪里开始尝试解决问题。有 22 列,600K 行。当我减少列数时,我得到与逻辑回归相同的结果。
为什么逻辑回归会如此错误?
**Actual from the data**
0 : 41932
1 : 573426
**Logistic regression output**
prediction for 1 when actually 0: 41932
prediction for 1 when actually 1:573426
A**s you can see, it always predicts a 1**
**Random forests does better:**
actual 0, pred 0 : 38800
actual 1, pred 0 : 27
actual 0, pred 1 : 3132
actual 1, pred 1 : 573399