1、添加权重
clf = RandomForestClassifier(n_estimators=10,class_weight ={0:0.81,1:0.19})
2、输出
pred = clf.predict_proba(test)#为概率
pred = clf.predict(test)#为结果
3、结果集分布
group_df = train.标签.value_counts().reset_index() k = group_df['标签'].sum() print((group_df.标签/k))