save_model

Save the model to a file.

Method call format

save_model(fname,
           format="cbm",
           export_parameters=None,
           pool=None)

Parameters

Parameter Possible types Description Default value
fname string

The path to the output model.

Required parameter
format string

The output format of the model.

Possible values:
  • cbm — CatBoost binary format.
  • coreml — Apple CoreML format (only datasets without categorical features are currently supported).
  • json — JSON format. Refer to the CatBoost JSON model tutorial for format details.
  • python — Standalone Python code (multiclassification models are not currently supported). See the Python section for details on applying the resulting model.
  • cpp — Standalone C++ code (multiclassification models are not currently supported). See the C++ section for details on applying the resulting model.
  • onnx — ONNX-ML format (only datasets without categorical features are currently supported). Refer to https://onnx.ai for details. See the ONNX section for details on applying the resulting model.
  • pmml — PMML version 4.3 format. Categorical features must be interpreted as one-hot encoded during the training if present in the training dataset. This can be accomplished by setting the --one-hot-max-size/one_hot_max_size parameter to a value that is greater than the maximum number of unique categorical feature values among all categorical features in the dataset. See the PMML section for details on applying the resulting model.

    Note.

    Multiclassification models are not currently supported.

cbm
export_parameters dict
Additional format-dependent parameters for:
None
pool
  • catboost.Pool
  • list
  • numpy.array
  • pandas.DataFrame
  • pandas.Series