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

from catboost import Pool

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

dataset = Pool(data)
print(dataset.num_row())

dataset_part = dataset.slice([0, 1, 2])
print(dataset_part.num_row())
Get a slice of five objects from the input dataset:
Output:
5
3