code: def test_early_stopping(MLPEstimator):
      X = X_digits_binary[:100]
      y = y_digits_binary[:100]
      tol = 0.2
      mlp_estimator = MLPEstimator(
          tol=tol, max_iter=3000, solver="sgd", early_stopping=True
      )
      mlp_estimator.fit(X, y)
      assert mlp_estimator.max_iter > mlp_estimator.n_iter_
  
      assert mlp_estimator.best_loss_ is None
      assert isinstance(mlp_estimator.validation_scores_, list)
  
      valid_scores = mlp_estimator.validation_scores_
      best_valid_score = mlp_estimator.best_validation_score_
      assert max(valid_scores) == best_valid_score
      assert best_valid_score + tol > valid_scores[-2]
      assert best_valid_score + tol > valid_scores[-1]
  
      # check that the attributes `validation_scores_` and `best_validation_score_`
      # are set to None when `early_stopping=False`
      mlp_estimator = MLPEstimator(
          tol=tol, max_iter=3000, solver="sgd", early_stopping=False
      )
      mlp_estimator.fit(X, y)
      assert mlp_estimator.validation_scores_ is None
      assert mlp_estimator.best_validation_score_ is None
      assert mlp_estimator.best_loss_ is not None
  
imports: import re
  import sys
  import warnings
  from io import StringIO
  import joblib
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_almost_equal, assert_array_equal
  from sklearn.datasets import load_digits, load_iris, make_multilabel_classification, make_regression
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.metrics import roc_auc_score
  from sklearn.neural_network import MLPClassifier, MLPRegressor
  from sklearn.preprocessing import LabelBinarizer, MinMaxScaler, scale
  from sklearn.utils._testing import ignore_warnings
  from sklearn.utils.fixes import CSR_CONTAINERS
label_desc: Use image node_id 24 for calling a global function with example usage: test_early_stopping(MLPEstimator) without return types