xgboost4j_2.12 1.6.2 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package ml
  Definition Classes
    root
-  package dmlc
  Definition Classes
    ml
-  package xgboost4j
  Definition Classes
    dmlc
-  package java
  Definition Classes
    xgboost4j
-  package util
  Definition Classes
    java
- Booster
- Column
- ColumnBatch
- DMatrix
- DeviceQuantileDMatrix
- ExternalCheckpointManager
- IEvaluation
- IObjective
- IRabitTracker
- Rabit
- RabitTracker
- TrackerProperties
- XGBoost
- XGBoostError

c

ml.dmlc.xgboost4j.java

# Booster 

###

#### class Booster extends Serializable with KryoSerializable

Booster for xgboost, this is a model API that support interactive build of a XGBoost Model

Linear Supertypes
KryoSerializable, Serializable, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. Booster
2. KryoSerializable
3. Serializable
4. AnyRef
5. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def boost(dtrain: DMatrix, grad: Array[Float], hess: Array[Float]): Unit

   update with give grad and hess

   update with give grad and hess

   dtrain

     training data

   grad

     first order of gradient

   hess

     seconde order of gradient

   Exceptions thrown

     `XGBoostError` native error

6.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
7.  def dispose(): Unit
8.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
9.  def equals(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
10.  def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], eval: IEvaluation, metricsOut: Array[Float]): String
11.  def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], eval: IEvaluation): String

    evaluate with given customized Evaluation class

    evaluate with given customized Evaluation class

    evalMatrixs

      evaluation matrix

    evalNames

      evaluation names

    eval

      custom evaluator

    returns

      eval information

    Exceptions thrown

      `XGBoostError` native error

12.  def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], iter: Int, metricsOut: Array[Float]): String

    evaluate with given dmatrixs.

    evaluate with given dmatrixs.

    evalMatrixs

      dmatrixs for evaluation

    evalNames

      name for eval dmatrixs, used for check results

    iter

      current eval iteration

    metricsOut

      output array containing the evaluation metrics for each evalMatrix

    returns

      eval information

    Exceptions thrown

      `XGBoostError` native error

13.  def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], iter: Int): String

    evaluate with given dmatrixs.

    evaluate with given dmatrixs.

    evalMatrixs

      dmatrixs for evaluation

    evalNames

      name for eval dmatrixs, used for check results

    iter

      current eval iteration

    returns

      eval information

    Exceptions thrown

      `XGBoostError` native error

14.  def finalize(): Unit
    Attributes
      protected[ml.dmlc.xgboost4j.java]
    Definition Classes
      Booster → AnyRef
15.  final def getAttr(key: String): String

    Get attribute from the Booster.

    Get attribute from the Booster.

    key

      attribute key

    returns

      attribute value

    Exceptions thrown

      `XGBoostError` native error

16.  final def getAttrs(): Map[String, String]

    Get attributes stored in the Booster as a Map.

    Get attributes stored in the Booster as a Map.

    returns

      A map contain attribute pairs.

    Exceptions thrown

      `XGBoostError` native error

17.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
18.  def getFeatureScore(featureMap: String): Map[String, Integer]

    Get importance of each feature

    Get importance of each feature

    returns

      featureScoreMap key: feature index, value: feature importance score, can be nill

    Exceptions thrown

      `XGBoostError` native error

19.  def getFeatureScore(featureNames: Array[String]): Map[String, Integer]

    Get importance of each feature with specified feature names.

    Get importance of each feature with specified feature names.

    returns

      featureScoreMap key: feature name, value: feature importance score, can be nill.

    Exceptions thrown

      `XGBoostError` native error

20.  def getModelDump(featureNames: Array[String], withStats: Boolean, format: String): Array[String]
21.  def getModelDump(featureNames: Array[String], withStats: Boolean): Array[String]

    Get the dump of the model as a string array with specified feature names.

    Get the dump of the model as a string array with specified feature names.

    featureNames

      Names of the features.

    returns

      dumped model information

    Exceptions thrown
22.  def getModelDump(featureMap: String, withStats: Boolean, format: String): Array[String]
23.  def getModelDump(featureMap: String, withStats: Boolean): Array[String]

    Get the dump of the model as a string array

    Get the dump of the model as a string array

    withStats

      Controls whether the split statistics are output.

    returns

      dumped model information

    Exceptions thrown

      `XGBoostError` native error

24.  def getNumFeature(): Long

    Get number of model features.

    Get number of model features.

    returns

      the number of features.

    Exceptions thrown
25.  def getScore(featureMap: String, importanceType: String): Map[String, Double]

    Get the feature importances for gain or cover (average or total), with feature names

    Get the feature importances for gain or cover (average or total), with feature names

    returns

      featureImportanceMap key: feature name, values: feature importance score based on gain or cover

    Exceptions thrown

      `XGBoostError` native error

26.  def getScore(featureNames: Array[String], importanceType: String): Map[String, Double]

    Get the feature importances for gain or cover (average or total)

    Get the feature importances for gain or cover (average or total)

    returns

      featureImportanceMap key: feature index, values: feature importance score based on gain or cover

    Exceptions thrown

      `XGBoostError` native error

27.  def getVersion(): Int
28.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
29.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
30.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
31.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
32.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
33.  def predict(data: DMatrix, outputMargin: Boolean, treeLimit: Int): Array[Array[Float]]

    Advanced predict function with all the options.

    Advanced predict function with all the options.

    data

      data

    outputMargin

      output margin

    treeLimit

      limit number of trees, 0 means all trees.

    returns

      predict results

34.  def predict(data: DMatrix, outputMargin: Boolean): Array[Array[Float]]

    Predict with data

    Predict with data

    data

      data

    outputMargin

      output margin

    returns

      predict results

35.  def predict(data: DMatrix): Array[Array[Float]]

    Predict with data

    Predict with data

    data

      dmatrix storing the input

    returns

      predict result

    Exceptions thrown

      `XGBoostError` native error

36.  def predictContrib(data: DMatrix, treeLimit: Int): Array[Array[Float]]

    Output feature contributions toward predictions of given data

    Output feature contributions toward predictions of given data

    data

      The input data.

    treeLimit

      Number of trees to include, 0 means all trees.

    returns

      The feature contributions and bias.

    Exceptions thrown
37.  def predictLeaf(data: DMatrix, treeLimit: Int): Array[Array[Float]]

    Predict leaf indices given the data

    Predict leaf indices given the data

    data

      The input data.

    treeLimit

      Number of trees to include, 0 means all trees.

    returns

      The leaf indices of the instance.

    Exceptions thrown
38.  def read(kryo: Kryo, input: Input): Unit
    Definition Classes
      Booster → KryoSerializable
39.  def saveModel(out: OutputStream): Unit

    Save the model to file opened as output stream.

    Save the model to file opened as output stream. The model format is compatible with other xgboost bindings. The output stream can only save one xgboost model. This function will close the OutputStream after the save.

    out

      The output stream

40.  def saveModel(modelPath: String): Unit

    Save model to modelPath

    Save model to modelPath

    modelPath

      model path

41.  final def setAttr(key: String, value: String): Unit

    Set attribute to the Booster.

    Set attribute to the Booster.

    key

      attribute key

    value

      attribute value

    Exceptions thrown

      `XGBoostError` native error

42.  def setAttrs(attrs: Map[String, String]): Unit

    Set attributes to the Booster.

    Set attributes to the Booster.

    attrs

      attributes key-value map

    Exceptions thrown

      `XGBoostError` native error

43.  final def setParam(key: String, value: Any): Unit

    Set parameter to the Booster.

    Set parameter to the Booster.

    key

      param name

    value

      param value

    Exceptions thrown

      `XGBoostError` native error

44.  def setParams(params: Map[String, AnyRef]): Unit

    Set parameters to the Booster.

    Set parameters to the Booster.

    params

      parameters key-value map

    Exceptions thrown

      `XGBoostError` native error

45.  def setVersion(version: Int): Unit
46.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
47.  def toByteArray(format: String): Array[Byte]

    Save model into raw byte array.

    Save model into raw byte array.

    format

      The output format. Available options are "json", "ubj" and "deprecated".

    returns

      the saved byte array

    Exceptions thrown

      `XGBoostError` native error

48.  def toByteArray(): Array[Byte]

    Save model into raw byte array.

    Save model into raw byte array. Currently it's using the deprecated format as default, which will be changed into `ubj` in future releases.

    returns

      the saved byte array

    Exceptions thrown

      `XGBoostError` native error

49.  def toString(): String
    Definition Classes
      AnyRef → Any
50.  def update(dtrain: DMatrix, obj: IObjective): Unit

    Update with customize obj func

    Update with customize obj func

    dtrain

      training data

    obj

      customized objective class

    Exceptions thrown

      `XGBoostError` native error

51.  def update(dtrain: DMatrix, iter: Int): Unit

    Update the booster for one iteration.

    Update the booster for one iteration.

    dtrain

      training data

    iter

      current iteration number

    Exceptions thrown

      `XGBoostError` native error

52.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
53.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
54.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )
55.  def write(kryo: Kryo, output: Output): Unit
    Definition Classes
      Booster → KryoSerializable

### Inherited from KryoSerializable

### Inherited from Serializable

### Inherited from AnyRef

### Inherited from Any

### Ungrouped