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

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}

A JSON array of metadata key-value pairs:

{"model_name":"value_1","key_2":"value_2",..,"key_N":"value_N"}

For example:

{"model_name":"catboost model","GUITARMAN3":"3","params":"{\"detailed_profile\":true,\"has_time\":false}"}

Get values of all keys

Execution format

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

Options

-m, --model-file, --model-path

Description

The name of the resulting files with the model description.

Used for solving other machine learning problems (for instance, applying a model) or defining the names of models in different output formats.

Corresponding file extensions are added to the given value if several output formats are defined in the --model-format parameter.

Default value

Required key

--dump-format

Description

The output format.

Possible values:

  • Plain
  • JSON

Default value

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}

A JSON array of metadata key-value pairs:

{"model_name":"value_1","key_2":"value_2",..,"key_N":"value_N"}

For example:

{"model_name":"catboost model","GUITARMAN3":"3","params":"{\"detailed_profile\":true,\"has_time\":false}"}

Set a key-value pair

Execution format

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

Options

-m, --model-file, --model-path

Description

The name of the resulting files with the model description.

Used for solving other machine learning problems (for instance, applying a model) or defining the names of models in different output formats.

Corresponding file extensions are added to the given value if several output formats are defined in the --model-format parameter.

Default value

Required key

--key

Description

The name of the key.

Default value

Required key

--value

Description

The value that the key should be set to.

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

Default value

Required key

-o

Description

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.

Default value

Input model (the values of existing keys are overridden)