Commit 03588f52 authored by linfang.wang's avatar linfang.wang

加入MySQL 连接

parent ccad6faa
......@@ -80,7 +80,7 @@ def modelfit(clf, dftrain, features, resp,useTrainCV = True, kfold=10, eval_metr
if useTrainCV:
# kflod = StratifiedKFold(n_splits=kfold, shuffle=True, random_state=7)
xgb_param = clf.get_xgb_params()
xgtrain = xgb.DMatrix(dftrain[features].values, label=dftrain[resp].values)
xgtrain = xgb.DMatrix(dftrain[features], label=dftrain[resp])
cvresult = xgb.cv(xgb_param, xgtrain, num_boost_round=clf.get_params()['n_estimators'], nfold=kfold,
metrics=eval_metric, early_stopping_rounds=early_stopping_rounds,verbose_eval=True)
clf.set_params(n_estimators=cvresult.shape[0])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment