Functions
The following functions are available globally.
-
Train a booster with given parameters.
Declaration
Parameters
data
DMatrix
numRound
Int - Number of boosting iterations.
params
[(String, String)] - Booster parameters. It was changed from Dictionary to array of set to enable multiple
eval_metric
, now it does not need to provideevalMetric
for multipleeval_metric
. You pass multiple sets foreval_metric
in the params array.evalSet
list of tuples (DMatrix, name of the eval data). The validation sets will evaluated during training.
fnObj
pass an optional custom objective function.
fnEval
pass an optional custom evaluation function.
modelFile
String - If the modelFile param is provided, it will load the model from that file.
callbacks
pass optional callbacks, which should conform to the
XGBCallback
protocolReturn Value
Booster
-
Cross-validation with given parameters
Declaration
Parameters
params
[(String, String)] - Booster parameters. It was changed from Dictionary to array of set to enable multiple
eval_metric
, now it does not need to provideevalMetric
for multipleeval_metric
. You pass multiple sets foreval_metric
in the params array.data
DMatrix
numRound
Int - Number of boosting iterations.
nFold
number of cross validation folds
fnObj
pass an optional custom objective function.
fnEval
pass an optional custom evaluation function.
callbacks
pass optional callbacks, which should conform to the
XGBCallback
protocolReturn Value
CVResult
-
Undocumented
Declaration
Swift
public func xgboostVersion() -> (major: Int, minor: Int, patch: Int)
-
Have to set
verbosity
parameters to 2(info)/3(debug) xgboost to make it print log messages. The passing closure should have 1 positional parameter, which is the log message.Declaration
Swift
public func xgbRegisterLogCallback(_ fn: (@convention(c) (UnsafePointer<Int8>?) -> Void)?)