---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://catboost.ai/docs/en/concepts/python-reference_catboostregressor_plot_predictions.md
  - href: en/concepts/python-reference_catboostregressor_plot_predictions.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

# plot_predictions

<!-- source: en/_includes/work_src/reusage-python/plot_predictions__desc__full.md -->
Sequentially vary the value of the specified features to put them into all buckets and calculate predictions for the input objects accordingly.

{% note alert %}

- Only models trained on datasets that do not contain categorical features are supported.
- Multiclassification modes are not supported.

{% endnote %}
<!-- endsource: en/_includes/work_src/reusage-python/plot_predictions__desc__full.md -->

<!-- source: en/_includes/work_src/reusage-python/plot_predictions__call_format.md -->
## Method call format {#call-format}

```python
plot_predictions(data, features_to_change, plot=True, plot_file=None)
```
<!-- endsource: en/_includes/work_src/reusage-python/plot_predictions__call_format.md -->

## Parameters {#parameters}

### data

#### Description

The data to plot predictions for.

For example, use a two-document slice of the original dataset (refer to the example below).


**Possible types:**

- numpy.ndarray
- pandas.DataFrame
- pandas.SparseDataFrame
- [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html)
- scipy.sparse.spmatrix (all subclasses except `dia_matrix`)
- catboost.Pool


**Default value**

Required parameter


### features_to_change

#### Description

The list of numerical features to vary the prediction value for.

For example, chose the required features by selecting top N most important features that impact the prediction results for a pair of objects according to [PredictionDiff](https://catboost.ai/docs/en/concepts/fstr.md#fstr__prediction-diff) (refer to the example below).

**Possible types**

- list of int
- string
- combination of list of int & string

**Default value**

Required parameter


### plot

#### Description

Plot a Jupyter Notebook chart based on the calculated predictions.

**Possible types**

bool

**Default value**

True


### plot_file

#### Description

The name of the output HTML-file to save the chart to.

**Possible types**

string

**Default value**

 1 (the trees are applied sequentially: the first tree, then the first two
                    trees, etc.)



## Return value {#output-format}

Dict with two fields:

- `params` — `dict` of best-found parameters.
- `cv_results` — `dict` or pandas.core.frame.DataFrame with cross-validation results. Сolumns are: `test-error-mean`, `test-error-std`, `train-error-mean`, `train-error-std`.

## Examples {#example}

```python
import numpy as np
from catboost import Pool, CatBoostRegressor

train_data = np.random.randint(0, 100, size=(100, 10))
train_label = np.random.randint(0, 1000, size=(100))
train_pool = Pool(train_data, train_label)
train_pool_slice = train_pool.slice([2, 3])

model = CatBoostRegressor()
model.fit(train_pool)

prediction_diff = model.get_feature_importance(train_pool_slice,
                                               type='PredictionDiff',
                                               prettified=True)

model.plot_predictions(data=train_pool_slice,
                       features_to_change=prediction_diff["Feature Id"][:2],
                       plot=True,
                       plot_file="plot_predictions_file.html")

```

An example of the first plotted chart:
![](../images/jupyter__catboostregressor__plot_prediction.png)
