---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://catboost.ai/docs/en/concepts/cli-reference_calc-model.md
  - href: en/concepts/cli-reference_calc-model.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# Apply a model

{% note info %}

<!-- source: en/_includes/work_src/reusage-common-phrases/cli__note__predict_note_for_packages_must-contain-all-features.md -->
The model prediction results will be correct only if the features data in the input dataset contains all the features used in the model. Typically, the order of these features must match the order of the corresponding columns that is provided during the training. But if feature names are provided both during the training and in the third column of the feature descriptions in the [columns description](https://catboost.ai/docs/en/concepts/input-data_column-descfile.md) file (specified with the `--column-description`/`--cd` parameter), they can be matched by names instead of the columns order.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/cli__note__predict_note_for_packages_must-contain-all-features.md -->

{% endnote %}


## Execution format {#execution-format}

```
catboost calc [optional parameters]
```

## Options {#options}

<!-- source: en/_includes/work_src/reusage/calc-model__options.md -->
### -m, --model-file,--model-path

#### Description

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

**Default value**

model.bin

### --model-format

#### Description

The format of the input model.

Possible values:
- CatboostBinary.AppleCoreML(only datasets without categorical features are currently supported).json (multiclassification models are not currently supported). Refer to the [CatBoost JSON model tutorial](https://github.com/catboost/tutorials/blob/master/model_analysis/model_export_as_json_tutorial.ipynb) for format details.

**Default value**

CatboostBinary


### --input-path

#### Description

The name of the input file with the [dataset](https://catboost.ai/docs/en/concepts/input-data_values-file.md).

**Default value**

input.tsv


### --column-description, --cd

#### Description

The path to the input file  that contains the [columns description](https://catboost.ai/docs/en/concepts/input-data_column-descfile.md).



**Default value**

If omitted, it is assumed that the first column in the file with the dataset description defines the label value, and the other columns are the values of numerical features.


### --input-pairs

#### Description

The path to the input file that contains the pairs description for the dataset.

This information is used for the calculation of Pairwise metrics.

**Default value**

Omitted

Pairwise metrics require pairs of data. If this data is not provided explicitly by specifying this parameter, pairs are generated automatically in each group using object label values


### --input-graph

#### Description

The path to the input file that contains the [graph information](https://catboost.ai/docs/en/concepts/input-data_graph-description.md) for the dataset.

This information is used for calculation of [Graph aggregated features](https://catboost.ai/docs/en/features/graph-aggregated-features.md).


**Default value**

Omitted


### -o, --output-path

#### Description

Defines the output settings for the resulting values of the model.

Supported value formats and types:
- `stream://<stream>` — Output the results to one of the program's standard output streams.

    `stream` is the name of the output stream. Possible values: `stdout` or `stderr`.

    For example, set the following value to output the results of applying the model to `stdout`:
    ```
    -o stream://stdout
    ```

- `[<path>/]<filename>.tsv` — Write the results into the specified file.
    - `path` is the optional path to the directory, where the resulting file should be saved to. By default, the file is saved to the same directory, from which the application is launched.
    - `filename` is the name of the output file.

    For example, set the following value to output the results of applying the model to the `/home/model/output-results.tsv` file:
    ```
    -o /home/model/output-results.tsv
    ```
The output data [format](https://catboost.ai/docs/en/concepts/output-data_model-value-output.md) depends on the machine learning task being solved.

**Default value**

output.tsv

### --output-columns

#### Description

A comma-separated list of columns names to output when forming the [results of applying the model](https://catboost.ai/docs/en/concepts/output-data_model-value-output.md) (including the ones obtained for the validation dataset when training).

Prediction and feature values can be output for each object of the input dataset. Auxiliary column can be output, if name for column was specified in column description. Additionally, some [column types](https://catboost.ai/docs/en/concepts/input-data_column-descfile.md) can be output if specified in the input data.

{% cut "Supported prediction types" %}

- Probability
- Class
- RawFormulaVal
- Exponent
- LogProbability

{% endcut %}

{% cut "Supported column types" %}

- `Label`
- `Baseline`
- `Weight`
- `SampleId` (`DocId`)
- `GroupId` (`QueryId`)
- `QueryId`
- `SubgroupId`
- `Timestamp`
- `GroupWeight`

{% endcut %}

The output columns can be set in any order. Format:

```
<prediction type 1>,[<prediction type 2> .. <prediction type N>][columns to output],[#<feature index 1>[:<name to output (user-defined)>] .. #<feature index N>[:<column name to output>]]
```

**Example**

```
--output-columns Probability,#3,#4:Feature4,Label,SampleId
```

In this example, features with indices 3 and 4 are output. The header contains the index (<q>#3</q>) for the feature indexed 3 and the string <q>Feature4</q> for the feature indexed 4.

{% cut "A fragment of the output" %}

```
Probability	#3	Feature4	Label	SampleId
0.4984999565	1	50.7799987793	0	0
0.8543220144	1	48.6333312988	2	1
0.7358535042	1	52.5699996948	1	2
0.8788711681	1	48.1699981689	2	3
```

{% endcut %}

{% note info %}

At least one of the specified columns must contain prediction values. For example, the following value raises an error:
```
--output-columns SampleId
```

{% endnote %}


**Default value**

All columns that are supposed to be output according to the chosen parameters are output

### -T, --thread-count

#### Description

<!-- source: en/_includes/work_src/reusage/thread-count-short-desc.md -->
The number of threads to use for operation.
<!-- endsource: en/_includes/work_src/reusage/thread-count-short-desc.md -->

<!-- source: en/_includes/work_src/reusage/thread_count__cpu_cores__optimizes-the-speed-of-execution.md -->
Optimizes the speed of execution. This parameter doesn't affect results.
<!-- endsource: en/_includes/work_src/reusage/thread_count__cpu_cores__optimizes-the-speed-of-execution.md -->


**Default value**

The number of processor cores


### --tree-count-limit

#### Description

The number of trees from the model to use when applying. If specified, the first <value> trees are used.

**Default value**

0 (if value equals to 0 this parameter is ignored and all trees from the model are used)


### --eval-period

#### Description

To reduce the number of trees to use when the model is applied or the metrics are calculated, set the step of the trees to use to `eval-period`.


<!-- source: en/_includes/work_src/reusage-common-phrases/cli__eval__period__desc.md -->
This parameter defines the step to iterate over the range `[--ntree-start; --ntree-end)`. For example, let's assume that the following parameter values are set:

- `--ntree-start` is set 0
- `--ntree-end` is set to N (the total tree count)
- `--eval-period` is set to 2

In this case, the results are returned for the following tree ranges: `[0, 2)`, `[0, 4)`, ... , `[0, N)`.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/cli__eval__period__desc.md -->


**Default value**

0 (the staged prediction mode is turned off)


### --prediction-type

#### Description

A comma-separated list of prediction types.

Supported prediction types:
- Probability
- Class
- RawFormulaVal
- Exponent
- LogProbability


**Default value**

RawFormulaVal
<!-- endsource: en/_includes/work_src/reusage/calc-model__options.md -->


