coremltools.converters.xgboost.convert¶
-
coremltools.converters.xgboost.
convert
(model, feature_names=None, target='target')¶ Convert a trained XGBoost model to Core ML format.
Parameters: decision_tree : Booster
A trained XGboost tree model.
feature_names: [str] | str
Names of input features that will be exposed in the Core ML model interface.
Can be set to one of the following:
- None for using the feature names from the model.
- List of names of the input features that should be exposed in the interface to the Core ML model. These input features are in the same order as the XGboost model.
target: str
Name of the output feature name exposed to the Core ML model.
Returns: model:MLModel
Returns an MLModel instance representing a Core ML model.
Examples
# Convert it with default input and output names >>> import coremltools >>> coreml_model = coremltools.converters.xgboost.convert(model) # Saving the Core ML model to a file. >>> coremltools.save('my_model.mlmodel')