你的dataframe是几个字段?可以截图下吗,你那个匿名函数里面的x是一个数据框
LYY202012
2021-03-21
过抽样前混淆矩阵
train confusion_matrix [[18875 131] [ 1 193]] classification report precision recall f1-score support 0 1.00 0.99 1.00 19006 1 0.60 0.99 0.75 194 accuracy 0.99 19200 macro avg 0.80 0.99 0.87 19200 weighted avg 1.00 0.99 0.99 19200 test confusion_matrix [[4722 30] [ 41 7]] classification report precision recall f1-score support 0 0.99 0.99 0.99 4752 1 0.19 0.15 0.16 48 accuracy 0.99 4800 macro avg 0.59 0.57 0.58 4800 weighted avg 0.98 0.99 0.98 4800
过抽样后混淆矩阵
train confusion_matrix [[18674 332] [ 29 18977]] classification report precision recall f1-score support 0 1.00 0.98 0.99 19006 1 0.98 1.00 0.99 19006 accuracy 0.99 38012 macro avg 0.99 0.99 0.99 38012 weighted avg 0.99 0.99 0.99 38012 test confusion_matrix [[4644 108] [ 40 4712]] classification report precision recall f1-score support 0 0.99 0.98 0.98 4752 1 0.98 0.99 0.98 4752 accuracy 0.98 9504 macro avg 0.98 0.98 0.98 9504 weighted avg 0.98 0.98 0.98 9504
fs陈晓亮
2021-03-19
从混淆矩阵看,你的模型对数据的拟和程度是比较高的。然后你把这个估计好的模型用于你测试集数据,然后把混淆矩阵给我贴一下,不用贴其他的,只需要贴混淆矩阵,我看下测试集预测效果
fs陈晓亮
2021-03-19
图一为过抽样前的f1值和auc,图二为过抽样,0和1的比例为1:1,图三为过抽样后的f1值和auc,图四为用新数据预测的1的数量。模型为随机森林,RandomForestClassifier(random_state=0,class_weight='balanced'),其余参数未调整。
fs陈晓亮
2021-03-19
你首先要过抽样将0 1 比例调整成1:1,然后将过采样后得到的新数据分成训练集和测试集,训练集数据用来对模型进行训练,测试集才进行测试。你的训练集数据训练的模型用于训练数据的预测,预测的准确率是多少?你可以截一下混淆矩阵的图
fs陈晓亮
2021-03-18