MCPcopy Create free account
hub / github.com/catboost/catboost / test_slice_pool

Function test_slice_pool

catboost/python-package/ut/medium/test.py:6118–6136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6116
6117
6118def test_slice_pool():
6119 pool = Pool(
6120 [[0], [1], [2], [3], [4], [5]],
6121 label=[0, 1, 2, 3, 4, 5],
6122 group_id=[0, 0, 0, 1, 1, 2],
6123 pairs=[(0, 1), (0, 2), (1, 2), (3, 4)])
6124
6125 for bad_indices in [[0], [2], [0, 0, 0]]:
6126 with pytest.raises(CatBoostError):
6127 pool.slice(bad_indices)
6128 rindexes = [
6129 [0, 1, 2],
6130 [3, 4],
6131 np.array([3, 4]),
6132 [5]
6133 ]
6134 for rindex in rindexes:
6135 sliced_pool = pool.slice(rindex)
6136 assert _check_data(sliced_pool.get_label(), list(rindex))
6137
6138
6139def test_fit_and_predict_on_sliced_pools(task_type):

Callers

nothing calls this directly

Calls 6

sliceMethod · 0.95
PoolClass · 0.90
get_labelMethod · 0.80
_check_dataFunction · 0.70
listClass · 0.50
arrayMethod · 0.45

Tested by

no test coverage detected