slice

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

Method call format

slice(rindex)

Parameters

rindex

Description

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

Possible types

list
numpy.ndarray

Default value

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