Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jvm-packages] Add new parameter singlePrecisionHistogram to xgboost4j-spark #5811

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class XGBoostClassifier (

def setCustomEval(value: EvalTrait): this.type = set(customEval, value)

def setSinglePrecisionHistogram(value: Boolean): this.type =
set(singlePrecisionHistogram, value)

// called at the start of fit/train when 'eval_metric' is not defined
private def setupDefaultEvalMetric(): String = {
require(isDefined(objective), "Users must set \'objective\' via xgboostParams.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ class XGBoostRegressor (

def setCustomEval(value: EvalTrait): this.type = set(customEval, value)

def setSinglePrecisionHistogram(value: Boolean): this.type =
set(singlePrecisionHistogram, value)

// called at the start of fit/train when 'eval_metric' is not defined
private def setupDefaultEvalMetric(): String = {
require(isDefined(objective), "Users must set \'objective\' via xgboostParams.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package ml.dmlc.xgboost4j.scala.spark.params

import scala.collection.immutable.HashSet

import org.apache.spark.ml.param.{DoubleParam, IntParam, Param, Params}
import org.apache.spark.ml.param.{DoubleParam, IntParam, BooleanParam, Param, Params}

private[spark] trait BoosterParams extends Params {

Expand Down Expand Up @@ -173,6 +173,14 @@ private[spark] trait BoosterParams extends Params {

final def getMaxBins: Int = $(maxBins)

/**
* whether to build histograms using single precision floating point values
*/
final val singlePrecisionHistogram = new BooleanParam(this, "singlePrecisionHistogram",
"whether to use single precision to build histograms")

final def getSinglePrecisionHistogram: Boolean = $(singlePrecisionHistogram)

/**
* This is only used for approximate greedy algorithm.
* This roughly translated into O(1 / sketch_eps) number of bins. Compared to directly select
Expand Down