code: def test_probability():
      # Predict probabilities.
      X, y = make_imbalance(
          iris.data,
          iris.target,
          sampling_strategy={0: 20, 1: 25, 2: 50},
          random_state=0,
      )
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, random_state=0
      )
  
      with np.errstate(divide="ignore", invalid="ignore"):
          # Normal case
          ensemble = BalancedBaggingClassifier(
              estimator=DecisionTreeClassifier(), random_state=0
          ).fit(X_train, y_train)
  
          assert_array_almost_equal(
              np.sum(ensemble.predict_proba(X_test), axis=1),
              np.ones(len(X_test)),
          )
  
          assert_array_almost_equal(
              ensemble.predict_proba(X_test),
              np.exp(ensemble.predict_log_proba(X_test)),
          )
  
          # Degenerate case, where some classes are missing
          ensemble = BalancedBaggingClassifier(
              estimator=LogisticRegression(
                  solver="lbfgs", multi_class="auto"
              ),
              random_state=0,
              max_samples=5,
          )
          ensemble.fit(X_train, y_train)
  
          assert_array_almost_equal(
              np.sum(ensemble.predict_proba(X_test), axis=1),
              np.ones(len(X_test)),
          )
  
          assert_array_almost_equal(
              ensemble.predict_proba(X_test),
              np.exp(ensemble.predict_log_proba(X_test)),
          )
  
imports: from collections import Counter
  import numpy
  import pytest
  import sklearn
  from sklearn.cluster import KMeans
  from sklearn.datasets import load_iris, make_classification, make_hastie_10_2
  from sklearn.dummy import DummyClassifier
  from sklearn.feature_selection import SelectKBest
  from sklearn.linear_model import LogisticRegression, Perceptron
  from sklearn.model_selection import GridSearchCV, ParameterGrid, train_test_split
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.svm import SVC
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.utils._testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from sklearn.utils.fixes import parse_version
  from imblearn import FunctionSampler
  from imblearn.datasets import make_imbalance
  from imblearn.ensemble import BalancedBaggingClassifier
  from imblearn.over_sampling import SMOTE, RandomOverSampler
  from imblearn.pipeline import make_pipeline
  from imblearn.under_sampling import ClusterCentroids, RandomUnderSampler
label_desc: Use image node_id 4 for calling a global function with example usage: test_probability() without return types