XGBRegressor.apply(X: Any, iteration_range: Optional[Tuple[int, int]] = None) numpy.ndarray#

Return the predicted leaf every tree for each sample. If the model is trained with early stopping, then best_iteration is used automatically.

  • X (array_like, shape=[n_samples, n_features]) – Input features matrix.

  • iteration_range – See predict().


X_leaves – For each datapoint x in X and for each tree, return the index of the leaf x ends up in. Leaves are numbered within [0; 2**(self.max_depth+1)), possibly with gaps in the numbering.

Return type

array_like, shape=[n_samples, n_trees]

This docstring was copied from xgboost.sklearn.XGBRegressor.