一、添加權重dom
clf = RandomForestClassifier(n_estimators=10,class_weight ={0:0.81,1:0.19})
二、輸出spa
pred = clf.predict_proba(test)#爲機率
pred = clf.predict(test)#爲結果
三、結果集分佈rest
group_df = train.標籤.value_counts().reset_index() k = group_df['標籤'].sum() print((group_df.標籤/k))