| 6116 | |
| 6117 | |
| 6118 | def 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 | |
| 6139 | def test_fit_and_predict_on_sliced_pools(task_type): |