Ejemplo n.º 1
0
 def get_estimator(self, idx):
     """Extract a single estimator tree from the forest.
     :param int idx: The index of the tree to extract.
     """
     check_is_fitted(self)
     if not self.enable_tree_details:
         raise ValueError(
             "enable_tree_details must be True prior to training")
     return RangerTreeSurvival.from_forest(self, idx=idx)
Ejemplo n.º 2
0
 def estimators_(self):
     try:
         check_is_fitted(self)
     except NotFittedError:
         raise AttributeError(
             f"{self.__class__.__name__} object has no attribute 'estimators_'"
         ) from None
     if not self.enable_tree_details:
         raise ValueError(
             "enable_tree_details must be True prior to training")
     return [
         RangerTreeSurvival.from_forest(self, idx=idx)
         for idx in range(self.n_estimators)
     ]