2016-09-28 105 views
2

我跑在Python Jupyter筆記本如下:XGBOOST verbose_eval在Jupyter不工作

import xgboost as xgb 
bst_dx=xgb.train(paramMap,dset,num_round,verbose_eval=True) 

出於某種原因,我從來沒有看到實際的詳細評估,這是應該在最後打印的當期虧損評估提升。我已經嘗試將verbose_eval設置爲1,2,3,4等,但仍然無法執行任何操作。我只是得到一個安靜的輸出。在Jupyter中需要啓用一些設置嗎?

回答

1

您還需要提供您的評估數據集以及您希望提前停止的無改進回合數。例如:

xgb_params = {"objective": "multi:softprob", "max_depth": 8, "silent": 1, "num_class":5} 
num_rounds = 1000 
dtrain = xgb.DMatrix(trainX, trainY) #training data 
dvalid = xgb.DMatrix(validX, validY) #validation data 
thisxgb = xgb.train(xgb_params, dtrain, num_rounds, \ 
        [(dtrain,'train'),(dvalid,'test')], \ 
        early_stopping_rounds=10\ 
        ) #stop if no improvement in 10 rounds