Skip to content

Commit 45b8fa3

Browse files
trivialfiswbo4958
andauthored
[backport][jvm-packages] Add setNumEarlyStoppingRounds (dmlc#11571) (dmlc#11579)
Co-authored-by: Bobby Wang <[email protected]>
1 parent baa832e commit 45b8fa3

File tree

1 file changed

+5
-3
lines changed
  • jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params

1 file changed

+5
-3
lines changed

jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/XGBoostParams.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private[spark] trait SparkParams[T <: Params] extends HasFeaturesCols with HasFe
122122
final val numWorkers = new IntParam(this, "numWorkers", "Number of workers used to train xgboost",
123123
ParamValidators.gtEq(1))
124124

125-
final def getNumRound: Int = $(numRound)
125+
final def getNumWorkers: Int = $(numWorkers)
126126

127127
final val forceRepartition = new BooleanParam(this, "forceRepartition", "If the partition " +
128128
"is equal to numWorkers, xgboost won't repartition the dataset. Set forceRepartition to " +
@@ -133,6 +133,8 @@ private[spark] trait SparkParams[T <: Params] extends HasFeaturesCols with HasFe
133133
final val numRound = new IntParam(this, "numRound", "The number of rounds for boosting",
134134
ParamValidators.gtEq(1))
135135

136+
final def getNumRound: Int = $(numRound)
137+
136138
final val numEarlyStoppingRounds = new IntParam(this, "numEarlyStoppingRounds", "Stop training " +
137139
"Number of rounds of decreasing eval metric to tolerate before stopping training",
138140
ParamValidators.gtEq(0))
@@ -213,14 +215,14 @@ private[spark] trait SparkParams[T <: Params] extends HasFeaturesCols with HasFe
213215
labelCol, baseMarginCol, weightCol, predictionCol, leafPredictionCol, contribPredictionCol,
214216
forceRepartition, featuresCols, customEval, customObj, featureTypes, featureNames)
215217

216-
final def getNumWorkers: Int = $(numWorkers)
217-
218218
def setNumWorkers(value: Int): T = set(numWorkers, value).asInstanceOf[T]
219219

220220
def setForceRepartition(value: Boolean): T = set(forceRepartition, value).asInstanceOf[T]
221221

222222
def setNumRound(value: Int): T = set(numRound, value).asInstanceOf[T]
223223

224+
def setNumEarlyStoppingRounds(value: Int): T = set(numEarlyStoppingRounds, value).asInstanceOf[T]
225+
224226
def setFeaturesCol(value: Array[String]): T = set(featuresCols, value).asInstanceOf[T]
225227

226228
def setBaseMarginCol(value: String): T = set(baseMarginCol, value).asInstanceOf[T]

0 commit comments

Comments
 (0)