2017-08-16 5 views
1

Ce n'est pas un bogue mais une question à comprendre. Quand j'appelle getModelDump de l'objet Booster, je n'ai pas autant d'arbres que j'ai dans le paramètre "num_round". Je pensais que si "num_round" est 100 alors, XGBoost va générer 100 arbres séquentiellement et je verrai tous ces arbres quand j'appelle getModelDump. Je suis sûr qu'il y a une raison logique derrière ou ma connaissance est erronée. Pourriez-vous s'il vous plaît expliquer cette situation?XGBoost ne génère pas autant d'arbres que spécifié dans le paramètre num_round

val paramMap = List(
     "eta" -> 0.1, "max_depth" -> 7, "objective" -> "binary:logistic", "num_round" ->100, 
     "eval_metric" -> "auc", "nworkers" -> 8).toMap 
    val xgboostEstimator = new XGBoostEstimator(paramMap) 
//TrainModel is another set of standard Spark features like StringIndexer, OnehotEncoding and VectorAssembler 
    val pipelineXGBoost = new Pipeline().setStages(Array(trainModel, xgboostEstimator)) 
    val cvModel = pipelineXGBoost.fit(train) 
//Below call generates only 2 tree instead of 100 as num_round is 100!!! 
    println(cvModel.stages(1).asInstanceOf[XGBoostClassificationModel].booster.getModelDump()(0)) 

lien Github à la question https://github.com/dmlc/xgboost/issues/2610

versions sont comme ci-dessous en utilisant scala 2,11

"ml.dmlc" % "xgboost4j" % "0.7", 
    "ml.dmlc" % "xgboost4j-spark" % "0.7", 
    "org.apache.spark" %% "spark-core" % "2.2.0", 
    "org.apache.spark" %% "spark-sql" % "2.2.0", 
    "org.apache.spark" %% "spark-graphx" % "2.2.0", 
    "org.apache.spark" %% "spark-mllib" % "2.2.0", 

Répondre