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

<!-- source: en/concepts/python-reference_catboost_get_object_importance.md -->
# get_object_importance

<!-- source: en/_includes/work_src/reusage/get_object_importance__div.md -->
Calculate the effect of objects from the train dataset on the optimized metric values for the objects from the input dataset:
- Positive values reflect that the optimized metric increases.
- Negative values reflect that the optimized metric decreases.

The higher the deviation from 0, the bigger the impact that an object has on the optimized metric.

The method is an implementation of the approach described in the [Finding Influential Training Samples for Gradient Boosted Decision Trees](https://arxiv.org/abs/1802.06640) paper .

Currently, object importance is supported only for the following loss functions.

Logloss

CrossEntropy

RMSE

MAE

Quantile

Expectile

LogLinQuantile

MAPE

Poisson
<!-- endsource: en/_includes/work_src/reusage/get_object_importance__div.md -->

## Method call format {#call-format}

```python
get_object_importance(pool,
                      train_pool,
                      top_size=-1,
                      type='Average',
                      update_method='SinglePoint',
                      importance_values_sign='All',
                      thread_count=-1,
                      verbose=False,
                      log_cout=sys.stdout,
                      log_cerr=sys.stderr)
```

## Parameters {#parameters}

<!-- source: en/_includes/work_src/reusage/get_object_importance__parameters.md -->
### pool

#### Description

The data for calculating object importances.

**Possible types**

catboost.Pool

**Default value**

Required parameter


### train_pool

#### Description

The dataset used for training.

**Possible types**

catboost.Pool

**Default value**

Required parameter


### top_size

#### Description

Defines the number of most important objects from the training dataset. The number of returned objects is limited to this number.


**Possible types**

int

**Default value**

-1 (top size is not limited)


### type

#### Description

The method for calculating the object importances.

Possible values:
- Average — The average of scores of objects from the training dataset for every object from the input dataset.
- PerObject — The scores of each object from the training dataset for each object from the input dataset.

**Possible types**

string

**Default value**

Average


### update_method

#### Description
The algorithm accuracy method.

Possible values:
- SinglePoint — The fastest and least accurate method.
- TopKLeaves — Specify the number of leaves. The higher the value, the more accurate and the slower the calculation.
- AllPoints — The slowest and most accurate method.

Supported parameters:
- `top` — Defines the number of leaves to use for the TopKLeaves update method. See the [Finding Influential Training Samples for Gradient Boosted Decision Trees](https://arxiv.org/abs/1802.06640) for more details.

For example, the following value sets the method to TopKLeaves and limits the number of leaves to 3:
```
TopKLeaves:top=3
```
**Possible types**

string

**Default value**

SinglePoint


### importance_values_sign

#### Description

Defines the type of effect that the objects from the training dataset must have on the optimized metric value for objects from the input dataset. Only the appropriate objects are output.
Possible values:
- Positive
- Negative
- All

**Possible types**

string

**Default value**

All


### 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 -->

**Possible types**

int

**Default value**

-1 (the number of threads is equal to the number of processor cores)

<!-- source: en/_includes/work_src/reusage-python/python__log-params.md -->
###  log_cout

Output stream or callback for logging.

**Possible types**

- callable Python object
- python object providing the `write()` method

**Default value**

sys.stdout

###  log_cerr

Error stream or callback for logging.

**Possible types**

- callable Python object
- python object providing the `write()` method

**Default value**

sys.stderr
<!-- endsource: en/_includes/work_src/reusage-python/python__log-params.md -->
<!-- endsource: en/_includes/work_src/reusage/get_object_importance__parameters.md -->

## Type of return value {#output-format}

<!-- source: en/_includes/work_src/reusage/get_object_importance__return-value-type__div.md -->
Two lists of lists with indices and scores.

For example, if the input dataset contains 3 rows and the training dataset contains 4 rows, the indices list takes the following structure:

```
[[1, 2, 3, 4], [4, 3, 2, 1], [1, 3, 4, 2]]
```

The scores list has the same structure with the corresponding scores instead of indices.
<!-- endsource: en/_includes/work_src/reusage/get_object_importance__return-value-type__div.md -->
<!-- endsource: en/concepts/python-reference_catboost_get_object_importance.md -->