calc_leaf_indexes

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

Method call format

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

Parameters

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).

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.

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 toeval_period.

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.

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

The number of threads to use for operation.

Optimizes the speed of execution. This parameter doesn't affect results.

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

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.