Functions
The following functions are available globally.
-
Train a booster with given parameters.
Declaration
Parameters
dataDMatrix
numRoundInt - 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 provideevalMetricfor multipleeval_metric. You pass multiple sets foreval_metricin the params array.evalSetlist of tuples (DMatrix, name of the eval data). The validation sets will evaluated during training.
fnObjpass an optional custom objective function.
fnEvalpass an optional custom evaluation function.
modelFileString - If the modelFile param is provided, it will load the model from that file.
callbackspass optional callbacks, which should conform to the
XGBCallbackprotocolReturn 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 provideevalMetricfor multipleeval_metric. You pass multiple sets foreval_metricin the params array.dataDMatrix
numRoundInt - Number of boosting iterations.
nFoldnumber of cross validation folds
fnObjpass an optional custom objective function.
fnEvalpass an optional custom evaluation function.
callbackspass optional callbacks, which should conform to the
XGBCallbackprotocolReturn Value
CVResult
-
Undocumented
Declaration
Swift
public func xgboostVersion() -> (major: Int, minor: Int, patch: Int) -
Have to set
verbosityparameters 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)?)
View on GitHub
Functions Reference