資料探勘實踐(金融風控)-第五次任務

bigdataworker發表於2020-09-27

pre = (pre1 + pre2 + pre3 +…+pren )/n
pre = 0.3pre1 + 0.3pre2 + 0.4pre3

from xgboost import XGBClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier, VotingClassifier
clf1 = LogisticRegression(random_state=1)
clf2 = RandomForestClassifier(random_state=1)
clf3 = XGBClassifier(learning_rate=0.1, n_estimators=150, max_depth=4, min_child_weight=2, subsample=0.7,objective=‘binary:logistic’)
vclf = VotingClassifier(estimators=[(‘lr’, clf1), (‘rf’, clf2), (‘xgb’, clf3)])
vclf = vclf .fit(x_train,y_train)
print(vclf .predict(x_test))

相關文章