Metadata manipulation

The CatBoost models contain metadata (for example, the list of training parameters or user-defined data) in key-value format. Several operations are provided to manipulate the model's metadata.

Get values of the selected keys

Execution format

catboost metadata get -m <path to the model> --key '<>' .. --key '<>' [--dump-format <output format>]

Options

OptionDescriptionDefault value

-m

--model-path

The name of the input file with the description of the model obtained as the result of training.

Required key
--model-format

The format of the input model.

Possible values:
  • CatboostBinary.
  • AppleCoreML (only datasets without categorical features are supported).
  • json (multiclassification models are not currently supported). Refer to the CatBoost JSON model tutorial for format details.
CatboostBinary
--key

The name of the key to retrieve data from.

The key can be set several times to output multiple values.

Required key
--dump-format

The output format.

Possible values:
  • Plain
  • JSON
Plain

Output format

The format of the data that is output to stdout depends on the selected mode:

Each line of the output contains tab-separated data on the key and its' value:

key_1</t>value_1
key_2</t>value_2
...
key_N</t>value_N
For example:
model_name</t>catboost model
params</t>{"detailed_profile":true,"used_ram_limit":18446744073709551615}

Get values of all keys

Execution format

catboost metadata dump -m <path to the model> [--dump-format <output format>]

Options

OptionDescriptionDefault value

-m

--model-path

The name of the input file with the description of the model obtained as the result of training.

Required key
--dump-format

The output format.

Possible values:
  • Plain
  • JSON
Plain

Output

The format of the data that is output to stdout depends on the selected mode:

Each line of the output contains tab-separated data on the key and its' value:

key_1</t>value_1
key_2</t>value_2
...
key_N</t>value_N
For example:
model_name</t>catboost model
params</t>{"detailed_profile":true,"used_ram_limit":18446744073709551615}

Set a key-value pair

Execution format

catboost metadata set -m <path to the model> --key '<>' --value 'VALUE' []

Options

OptionDescriptionDefault value

-m

--model-path

The name of the input file with the description of the model obtained as the result of training.

Required key
--key

The name of the key.

Required key
--value

The value that the key should be set to.

The given value overwrites existing data if the specified key matches an existing one.

Required key
-o

The path to the output model.

If defined, the key-value pair and the initial model's key-value pairs are written to the specified model and the input model is not affected by the operation.

Input model (the values of existing keys are overridden)