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
- All
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, iter: Int, grad: Array[Float], hess: Array[Float]): Unit
Update with give grad and hess
Update with give grad and hess
- dtrain
training data
- iter
The current training iteration.
- 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( ... ) @native()
- def dispose(): Unit
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): 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[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @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 getNumBoostedRound(): Int
-
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
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
inplace_predict(data: Array[Float], nrow: Int, ncol: Int, missing: Float, iteration_range: Array[Int], predict_type: PredictionType, base_margin: Array[Float]): Array[Array[Float]]
Perform thread-safe prediction.
Perform thread-safe prediction.
- data
Flattened input matrix of features for prediction
- nrow
The number of preditions to make (count of input matrix rows)
- ncol
The number of features in the model (count of input matrix columns)
- missing
Value indicating missing element in the
data
input matrix- iteration_range
Specifies which layer of trees are used in prediction. For example, if a random forest is trained with 100 rounds. Specifying
iteration_range=[10, 20)
, then only the forests built during [10, 20) (half open set) rounds are used in this prediction.- predict_type
What kind of prediction to run.
- returns
predict Result matrix
-
def
inplace_predict(data: Array[Float], nrow: Int, ncol: Int, missing: Float, iteration_range: Array[Int]): Array[Array[Float]]
Perform thread-safe prediction.
Perform thread-safe prediction.
- data
Flattened input matrix of features for prediction
- nrow
The number of preditions to make (count of input matrix rows)
- ncol
The number of features in the model (count of input matrix columns)
- missing
Value indicating missing element in the
data
input matrix- iteration_range
Specifies which layer of trees are used in prediction. For example, if a random forest is trained with 100 rounds. Specifying
iteration_range=[10, 20)
, then only the forests built during [10, 20) (half open set) rounds are used in this prediction.- returns
predict Result matrix
-
def
inplace_predict(data: Array[Float], nrow: Int, ncol: Int, missing: Float): Array[Array[Float]]
Perform thread-safe prediction.
Perform thread-safe prediction.
- data
Flattened input matrix of features for prediction
- nrow
The number of preditions to make (count of input matrix rows)
- ncol
The number of features in the model (count of input matrix columns)
- missing
Value indicating missing element in the
data
input matrix- returns
predict Result matrix
-
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
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @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: Any): 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
-
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 in the UBJSON ("ubj") format.
Save model into raw byte array in the UBJSON ("ubj") format.
- returns
the saved byte array
- Exceptions thrown
XGBoostError
native error
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
update(dtrain: DMatrix, iter: Int, obj: IObjective): Unit
Update with customize obj func
Update with customize obj func
- dtrain
training data
- iter
The current training iteration.
- 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(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
write(kryo: Kryo, output: Output): Unit
- Definition Classes
- Booster → KryoSerializable
- Annotations
- @Override()
Deprecated Value Members
-
def
boost(dtrain: DMatrix, grad: Array[Float], hess: Array[Float]): Unit
- Annotations
- @Deprecated
- Deprecated
-
def
update(dtrain: DMatrix, obj: IObjective): Unit
- Annotations
- @Deprecated
- Deprecated