code: def test_sample_weight():
      # Make sure that:
      #    prediction with weight
      # != prediction with no weight
      # == prediction with weight ones
      random.seed(87)
      w = np.array([random.random() for _ in range(len(y))])
  
      np.random.seed(123)
      meta = LogisticRegression(solver="liblinear", multi_class="ovr")
      clf1 = RandomForestClassifier(n_estimators=10)
      clf2 = GaussianNB()
      sclf = StackingClassifier(
          classifiers=[clf1, clf2], meta_classifier=meta
      )
      prob1 = sclf.fit(X, y, sample_weight=w).predict_proba(X)
  
      np.random.seed(123)
      meta = LogisticRegression(solver="liblinear", multi_class="ovr")
      clf1 = RandomForestClassifier(n_estimators=10)
      clf2 = GaussianNB()
      sclf = StackingClassifier(
          classifiers=[clf1, clf2], meta_classifier=meta
      )
      prob2 = sclf.fit(X, y, sample_weight=None).predict_proba(X)
  
      maxdiff = np.max(np.abs(prob1 - prob2))
      assert maxdiff > 1e-3, "max diff is %.4f" % maxdiff
  
      np.random.seed(123)
      meta = LogisticRegression(solver="liblinear", multi_class="ovr")
      clf1 = RandomForestClassifier(n_estimators=10)
      clf2 = GaussianNB()
      sclf = StackingClassifier(
          classifiers=[clf1, clf2], meta_classifier=meta
      )
      prob3 = sclf.fit(
          X, y, sample_weight=np.ones(len(y))
      ).predict_proba(X)
  
      maxdiff = np.max(np.abs(prob2 - prob3))
      assert maxdiff < 1e-3, "max diff is %.4f" % maxdiff
  
imports: import random
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal
  from packaging.version import Version
  from scipy import sparse
  from sklearn import __version__
  from sklearn import exceptions
  from sklearn.base import clone
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.linear_model import LogisticRegression, PassiveAggressiveClassifier
  from sklearn.model_selection import GridSearchCV, cross_val_score, train_test_split
  from sklearn.naive_bayes import GaussianNB
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.svm import SVC
  from mlxtend.classifier import StackingClassifier
  from mlxtend.data import iris_data
  from mlxtend.externals.estimator_checks import NotFittedError
  from mlxtend.utils import assert_raises
label_desc: Use image node_id 4 for calling a global function with example usage: test_sample_weight() without return types