[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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user