load_model

Load the model from a file.

Method call format

load_model(fname, format='cbm')

Parameters

Parameter Possible types Description Default value
fname string

The path to the input model.

Required parameter
format string

The format of the input model.

Possible values:
  • cbm — CatBoost binary format.
  • AppleCoreML (only datasets without categorical features are currently supported).
  • json — JSON format. Refer to the CatBoost JSON model tutorial for format details.
  • 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.
cbm
Parameter Possible types Description Default value
fname string

The path to the input model.

Required parameter
format string

The format of the input model.

Possible values:
  • cbm — CatBoost binary format.
  • AppleCoreML (only datasets without categorical features are currently supported).
  • json — JSON format. Refer to the CatBoost JSON model tutorial for format details.
  • 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.
cbm

Usage examples

from catboost import CatBoostClassifier, Pool

train_data = [[1, 3],
              [0, 4],
              [1, 7]]
train_labels = [1, 0, 1]

# catboost_pool = Pool(train_data, train_labels)

model = CatBoostClassifier(learning_rate=0.03)
model.fit(train_data,
          train_labels,
          verbose=False)

model.save_model("model")

from_file = CatBoostClassifier()

from_file.load_model("model")