Loan Status Y N Python sklearn matplotlib numpy
问题简介 目标&选择原因 二分类问题 § 从样本中获得信息,预测是否要给一个人提供贷 Loan Status 款 § 本案例最大的特殊之处是展现简单的数据处理对 模型的提升作用 Y N 相关 具&模型 案例来源 § Python § sklearn, matplotlib, numpy, pandas, seaborn, § https: //www. kaggle. com/yaheaal/loan-status- § scipy a) logistic regression b) KNeighbors. Classifier c) SVC d) Decision. Tree. Classifier § with-different-models 数据:https: //www. kaggle. com/yaheaal/loanstatus-with-different-models/data 4
探索性数据分析 共同申请人收入 数值型特征探索 Applicant. Income Coapplicant. Income Loan. Amount Loan_Amount_Term N 3833. 5 268 129 360 Y 3812. 5 1239. 5 126 360 Loan_Status 14
训练集、测试集划分 目标“贷款状态”样本量分布不均 采用分层取样方法 将总体单位按其属性特征分成若干类型或层,然后在类型或层 中随机抽取样本单位 ratio of target in y_train : [0. 68635438 0. 31364562] ratio of target in y_test : [0. 69105691 0. 30894309] ratio of target in original_data : [0. 68729642 0. 31270358] 17
模型选择 四种模型 Logistic Regression KNN Classification SVC Decision Tree 19
模型简介 SVC Decision Tree Logistic Regression KNN 根据所需预测样本的特征寻找 距离最近的K个样本点,取其 加权平均作为预测值; 寻找距离最近时有Brute Force、 kd tree、ball tree三种算法; 本例auto;应当是根据维度数 加权平均可以取均匀的或距离 倒数加权等;本案例使用均匀 加权 https: //zhuanlan. zhihu. com/p/28660098 https: //zhuanlan. zhihu. com/p/26703300 https: //blog. csdn. net/pipisorry/article/details/52186307 20
模型简介 KNN(续) https: //blog. csdn. net/pipisorry/article/details/52186307 https: //www. cnblogs. com/lesleysbw/p/6074662. html https: //www. zhihu. com/question/30957691 21
模型评估指标 5种指标 Precision Accuracy Score Log loss F 1 Recall 22
模型评估指标 预测类别 实际类别 Precision Log loss Yes No Yes TP FN 总计 P(实际为Yes) No FP TN N(实际为No) Recall F 1 23
THANKS!
- Slides: 37