I am using spark xgboost4j 0.80 with scala, wonder how to print out the train and validation loss in each round (for example set num_round as 100, print out train and validation loss in 100 rounds during training). I have made it before on the non distributed version xgboost like this:
While I don't figure out how to achieve this in xgboost4j, I found an example code while there's no changes in the stdout after I create the evaluation set and specify it in the XGBoostClassifier's parameters map. I have searched a lot on the Internet while don't find similar questions and solutions.
My code is like:
val params = Map("eta" -> 0.1f,
"lambda" -> 0.1f,
"max_depth" -> 6,
"objective" -> "binary:logistic",
"num_workers" -> 10
"num_round" -> 100,
// "num_early_stopping_rounds" -> 10,
// "maximize_evaluation_metrics" -> false,
// "eval_metric" -> "logloss",
"eval_sets" -> Map("eval" -> eval)
)
val xgb = new XGBoostClassifier(params).
setFeaturesCol("features").
setLabelCol("label")
val model = xgb.fit(train)
Thanks in advance for your help.
