我正在尝试解决名为“ 行人检测”的任务,并且在两个类别的积极因素(人,负面因素)的背景上训练二进制clasifer。
我有数据集:
- 正数= 3752
- 负数= 3800
我使用 带有参数的train \ test split 80 \ 20%和RandomForestClassifier形式scikit-learn:
RandomForestClassifier(n_estimators=100, max_depth=50, n_jobs= -1)
我得到分数:95.896757%
测试训练数据(完美运行):
true positive: 3005
false positive: 0
false negative: 0
true negative: 3036
对测试数据进行测试:
true positive: 742
false positive: 57
false negative: 5
true negative: 707
我的问题是如何减少误报(背景分类为人)的数量?另外,为什么我的误报错误多于误报错误?
我尝试使用class_weight
参数,但有时性能会下降(如class_weight = {0:1,1:4}所示)。
class_weight= {0:1,1:1}
true positive: 3005
false positive: 0
false negative: 0
true negative: 3036
true positive: 742
false positive: 55
false negative: 5
true negative: 709
score: 96.029120 %
class_weight= {0:1,1:2}
true positive: 3005
false positive: 0
false negative: 0
true negative: 3036
true positive: 741
false positive: 45
false negative: 6
true negative: 719
score: 96.624752 %
class_weight= {0:1,1:3}
true positive: 3005
false positive: 0
false negative: 0
true negative: 3036
true positive: 738
false positive: 44
false negative: 9
true negative: 720
score: 96.492389 %
class_weight= {0:1,1:4}
true positive: 3005
false positive: 13
false negative: 0
true negative: 3023
true positive: 735
false positive: 46
false negative: 12
true negative: 718
score: 96.161482 %
class_weight= {0:1,1:5}
true positive: 3005
false positive: 31
false negative: 0
true negative: 3005
true positive: 737
false positive: 48
false negative: 10
true negative: 716
score: 96.161482 %
class_weight= {0:1,1:6}
true positive: 3005
false positive: 56
false negative: 0
true negative: 2980
true positive: 736
false positive: 51
false negative: 11
true negative: 713
score: 95.896757 %
class_weight= {0:1,1:7}
true positive: 3005
false positive: 87
false negative: 0
true negative: 2949
true positive: 734
false positive: 59
false negative: 13
true negative: 705
score: 95.234944 %
另外值得注意的是,RandomForest似乎没有遭受不平衡数据集的困扰:
pos = 3752 neg = 10100
class_weight = {0:1,1:1}真肯定:3007假肯定:0假否定:0真否定:8074
true positive: 729
false positive: 71
false negative: 16
true negative: 1955
score: 96.860339 %
class_weight= {0:1,1:2}
true positive: 3007
false positive: 0
false negative: 0
true negative: 8074
true positive: 728
false positive: 59
false negative: 17
true negative: 1967
score: 97.257308 %
class_weight= {0:1,1:3}
true positive: 3007
false positive: 0
false negative: 0
true negative: 8074
true positive: 727
false positive: 58
false negative: 18
true negative: 1968
score: 97.257308 %
stats.stackexchange.com/questions/163799/...
—
user141645