class_docstr: Base class for histogram-based gradient boosting estimators.
class_docstr_tok: ["Base","class","for","histogram-based","gradient","boosting","estimators","."]
docstr: Check if fitting should be early-stopped based on scorer.
  
  Scores are computed on validation data or on training data.
docstr_tok: ["Check","if","fitting","should","be","early-stopped","based","on","scorer",".","Scores","are","computed","on","validation","data","or","on","training","data","."]
code: def _check_early_stopping_scorer(
      self,
      X_binned_small_train,
      y_small_train,
      sample_weight_small_train,
      X_binned_val,
      y_val,
      sample_weight_val,
  ):
      """Check if fitting should be early-stopped based on scorer.
  
      Scores are computed on validation data or on training data.
      """
      if is_classifier(self):
          y_small_train = self.classes_[y_small_train.astype(int)]
  
      if sample_weight_small_train is None:
          self.train_score_.append(
              self._scorer(self, X_binned_small_train, y_small_train)
          )
      else:
          self.train_score_.append(
              self._scorer(
                  self,
                  X_binned_small_train,
                  y_small_train,
                  sample_weight=sample_weight_small_train,
              )
          )
  
      if self._use_validation_data:
          if is_classifier(self):
              y_val = self.classes_[y_val.astype(int)]
          if sample_weight_val is None:
              self.validation_score_.append(
                  self._scorer(self, X_binned_val, y_val)
              )
          else:
              self.validation_score_.append(
                  self._scorer(
                      self,
                      X_binned_val,
                      y_val,
                      sample_weight=sample_weight_val,
                  )
              )
          return self._should_stop(self.validation_score_)
      else:
          return self._should_stop(self.train_score_)
  
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 10 for calling the BaseHistGradientBoosting obj's underlying member method code with example usage: obj._check_early_stopping_scorer(X_binned_small_train, y_small_train, sample_weight_small_train, X_binned_val, y_val, sample_weight_val) and returns: self, self