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 Using models exported as Python code section for details on applying the resulting model.
  • cpp — Standalone C++ code (multiclassification models are not currently supported). See the Using models exported as C++ code 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 Using models exported to ONNX-ML format section for details on applying the resulting model.
cbm
export_parameters dict

Additional format-dependent parameters.

Apple CoreML
Possible values (all are strings):
  • prediction_type. Possible values are “probability ”and “raw”.

  • coreml_description

  • coreml_model_version

  • coreml_model_author

  • coreml_model_license

ONNX-ML
  • onnx_graph_name
  • onnx_domain
  • onnx_model_version
  • onnx_doc_string

See the ONNX-ML parameters reference for details.

None
pool
  • catboost.Pool
  • list
  • numpy.array
  • pandas.DataFrame
  • pandas.Series
  • catboost.FeaturesData

The dataset previously used for training.

This parameter is required if the model contains categorical features and the output format is python or JSON.
Note.

The model can be saved to the JSON format without a pool. In this case it is available for review but it is not applicable.

None
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 Using models exported as Python code section for details on applying the resulting model.
  • cpp — Standalone C++ code (multiclassification models are not currently supported). See the Using models exported as C++ code 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 Using models exported to ONNX-ML format section for details on applying the resulting model.
cbm
export_parameters dict

Additional format-dependent parameters.

Apple CoreML
Possible values (all are strings):
  • prediction_type. Possible values are “probability ”and “raw”.

  • coreml_description

  • coreml_model_version

  • coreml_model_author

  • coreml_model_license

ONNX-ML
  • onnx_graph_name
  • onnx_domain
  • onnx_model_version
  • onnx_doc_string

See the ONNX-ML parameters reference for details.

None
pool
  • catboost.Pool
  • list
  • numpy.array
  • pandas.DataFrame
  • pandas.Series
  • catboost.FeaturesData

The dataset previously used for training.

This parameter is required if the model contains categorical features and the output format is python or JSON.
Note.

The model can be saved to the JSON format without a pool. In this case it is available for review but it is not applicable.

None