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

Returns indexes of leafs to which objects from pool are mapped by model trees.

## Method call format {#python__calc_leaf_indexes__call-format}

```python
calc_leaf_indexes(data, ntree_start=0, ntree_end=0, thread_count=-1, verbose=False)
```

## Parameters {#params}

### data

#### Description

A file or matrix with the input dataset.

**Possible values**

catboost.Pool

**Default value**

Required parameter


### ntree_start

#### Description

To reduce the number of trees to use when the model is applied or the metrics are calculated, set the range of the tree indices to`[ntree_start; ntree_end)`.

<!-- source: en/_includes/work_src/reusage-common-phrases/ntree_start__short-param-desc.md -->
This parameter defines the index of the first tree to be used when applying the model or calculating the metrics (the inclusive left border of the range). Indices are zero-based.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/ntree_start__short-param-desc.md -->

**Possible values**

int

**Default value**

0


### ntree_end

#### Description

To reduce the number of trees to use when the model is applied or the metrics are calculated, set the range of the tree indices to`[ntree_start; ntree_end)` and the step of the trees to use to`eval_period`.

<!-- source: en/_includes/work_src/reusage-common-phrases/ntree_end__short-param-desc.md -->
This parameter defines the index of the first tree not to be used when applying the model or calculating the metrics (the exclusive right border of the range). Indices are zero-based.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/ntree_end__short-param-desc.md -->

**Possible values**

int

**Default value**

0 (the index of the last tree to use equals to the number of trees in the
                    model minus one)

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

int

**Default value**

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


### verbose

#### Description

Enable debug logging level.

**Possible values**

bool

**Default value**

False



## Type of return value {#output}

leaf_indexes : 2-dimensional numpy.ndarray of numpy.uint32 with shape (object count, ntree_end – ntree_start). i-th row is an array of leaf indexes for i-th object.
<!-- endsource: en/_includes/concepts/python-reference_catboost_calc_leaf_indexes.md -->
