class_docstr: Base class for histogram-based gradient boosting estimators.
class_docstr_tok: ["Base","class","for","histogram-based","gradient","boosting","estimators","."]
docstr: Return True (do early stopping) if the last n scores aren't better
  than the (n-1)th-to-last score, up to some tolerance.
docstr_tok: ["Return","True","(","do","early","stopping",")","if","the","last","n","scores","are","n't","better","than","the","(","n-1",")","th-to-last","score",",","up","to","some","tolerance","."]
code: def _should_stop(self, scores):
      """
      Return True (do early stopping) if the last n scores aren't better
      than the (n-1)th-to-last score, up to some tolerance.
      """
      reference_position = self.n_iter_no_change + 1
      if len(scores) < reference_position:
          return False
  
      # A higher score is always better. Higher tol means that it will be
      # harder for subsequent iteration to be considered an improvement upon
      # the reference score, and therefore it is more likely to early stop
      # because of the lack of significant improvement.
      reference_score = scores[-reference_position] + self.tol
      recent_scores = scores[-reference_position + 1 :]
      recent_improvements = [
          score > reference_score for score in recent_scores
      ]
      return not any(recent_improvements)
  
imports: import itertools
  from abc import ABC, abstractmethod
  from functools import partial
  from numbers import Integral, Real
  from timeit import default_timer
  import numpy
  from ..._loss.loss import _LOSSES, BaseLoss, HalfBinomialLoss, HalfGammaLoss, HalfMultinomialLoss, HalfPoissonLoss, PinballLoss
  from ...base import BaseEstimator, ClassifierMixin, RegressorMixin, _fit_context, is_classifier
  from ...metrics import check_scoring
  from ...model_selection import train_test_split
  from ...preprocessing import LabelEncoder
  from ...utils import check_random_state, compute_sample_weight, resample
  from ...utils._openmp_helpers import _openmp_effective_n_threads
  from ...utils._param_validation import Interval, RealNotInt, StrOptions
  from ...utils.multiclass import check_classification_targets
  from ...utils.validation import _check_monotonic_cst, _check_sample_weight, check_consistent_length, check_is_fitted
  from ._gradient_boosting import _update_raw_predictions
  from .binning import _BinMapper
  from .common import G_H_DTYPE, X_DTYPE, Y_DTYPE
  from .grower import TreeGrower
label_desc: Use image node_id 12 for calling the BaseHistGradientBoosting obj's underlying member method code with example usage: obj._should_stop(scores) and returns: unknown, False