class Booster extends Serializable with KryoSerializable
Booster for xgboost, this is a model API that support interactive build of a XGBoost Model
- Alphabetic
- By Inheritance
- Booster
- KryoSerializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def dispose(): Unit
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def evalSet(evalMatrixs: Array[DMatrix], evalNames: Array[String], eval: IEvaluation, metricsOut: Array[Float]): String
- 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
- 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
- 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
- def finalize(): Unit
- 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
- 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
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def getFeatureNames(): Array[String]
Get feature names from the Booster.
Get feature names from the Booster.
- Exceptions thrown
- 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
- 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
- final def getFeatureTypes(): Array[String]
Get feature types from the Booster.
Get feature types from the Booster.
- Exceptions thrown
- def getModelDump(featureNames: Array[String], withStats: Boolean, format: String): Array[String]
- 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
- def getModelDump(featureMap: String, withStats: Boolean, format: String): Array[String]
- 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
- def getNumFeature(): Long
Get number of model features.
Get number of model features.
- returns
the number of features.
- Exceptions thrown
- 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
- 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
- def getVersion(): Int
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- 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
- def predict(data: DMatrix, outputMargin: Boolean): Array[Array[Float]]
Predict with data
Predict with data
- data
data
- outputMargin
output margin
- returns
predict results
- 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
- 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
- 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
- def read(kryo: Kryo, input: Input): Unit
- Definition Classes
- Booster → KryoSerializable
- Annotations
- @Override()
- def saveModel(out: OutputStream, format: String): 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
- format
The model format (ubj, json, deprecated)
- Exceptions thrown
- 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
- def saveModel(modelPath: String): Unit
Save model to modelPath
Save model to modelPath
- modelPath
model path
- 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
- 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
- def setFeatureNames(featureNames: Array[String]): Unit
Set feature names to the Booster.
Set feature names to the Booster.
- Exceptions thrown
- def setFeatureTypes(featureTypes: Array[String]): Unit
Set feature types to the Booster.
Set feature types to the Booster.
- Exceptions thrown
- final def setParam(key: String, value: AnyRef): Unit
Set parameter to the Booster.
Set parameter to the Booster.
- key
param name
- value
param value
- Exceptions thrown
XGBoostError
native error
- 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
- def setVersion(version: Int): Unit
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- 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
- 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
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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
- 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
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def write(kryo: Kryo, output: Output): Unit
- Definition Classes
- Booster → KryoSerializable
- Annotations
- @Override()