slice

Form a slice of the input dataset from the given list of object indices.

Method call format

slice(rindex)

Parameters

Parameter Possible types Description Default value
rindex
  • list
  • numpy.array

The indices of objects to form the slice of the dataset from.

Required parameter

Type of return value

catboost.Pool

Example

Get a slice of five objects from the input dataset:
from catboost import Pool

train_data = [[1, 3],
              [0, 4],
              [1, 7],
              [6, 4],
              [5, 3]]

input_pool = Pool(train_data)
print(input_pool.num_row())

pool_part = input_pool.slice([0, 1, 2])
print(pool_part.num_row())
Output:
5
3