[MT-TREE] Support prediction cache and model slicing. (#8968)

- Fix prediction range.
- Support prediction cache in mt-hist.
- Support model slicing.
- Make the booster a Python iterable by defining `__iter__`.
- Cleanup removed/deprecated parameters.
- A new field in the output model `iteration_indptr` for pointing to the ranges of trees for each iteration.
This commit is contained in:
Jiaming Yuan
2023-03-27 23:10:54 +08:00
committed by GitHub
parent c2b3a13e70
commit acc110c251
30 changed files with 502 additions and 343 deletions

View File

@@ -17,6 +17,7 @@ from typing import (
Any,
Callable,
Dict,
Generator,
Iterable,
List,
Optional,
@@ -1756,6 +1757,10 @@ class Booster:
sliced.handle = sliced_handle
return sliced
def __iter__(self) -> Generator["Booster", None, None]:
for i in range(0, self.num_boosted_rounds()):
yield self[i]
def save_config(self) -> str:
"""Output internal parameter configuration of Booster as a JSON
string.