code: def test_sample_weight():
      # with no weight
      np.random.seed(123)
      clf1 = LogisticRegression(solver="liblinear", multi_class="ovr")
      clf2 = RandomForestClassifier(n_estimators=10)
      clf3 = GaussianNB()
      eclf = EnsembleVoteClassifier(
          clfs=[clf1, clf2, clf3], voting="hard"
      )
      prob1 = eclf.fit(X, y).predict_proba(X)
  
      # with weight = 1
      w = np.ones(len(y))
      np.random.seed(123)
      clf1 = LogisticRegression(solver="liblinear", multi_class="ovr")
      clf2 = RandomForestClassifier(n_estimators=10)
      clf3 = GaussianNB()
      eclf = EnsembleVoteClassifier(
          clfs=[clf1, clf2, clf3], voting="hard"
      )
      prob2 = eclf.fit(X, y, sample_weight=w).predict_proba(X)
  
      # with random weight
      random.seed(87)
      w = np.array([random.random() for _ in range(len(y))])
      np.random.seed(123)
      clf1 = LogisticRegression(solver="liblinear", multi_class="ovr")
      clf2 = RandomForestClassifier(n_estimators=10)
      clf3 = GaussianNB()
      eclf = EnsembleVoteClassifier(
          clfs=[clf1, clf2, clf3], voting="hard"
      )
      prob3 = eclf.fit(X, y, sample_weight=w).predict_proba(X)
  
      diff12 = np.max(np.abs(prob1 - prob2))
      diff23 = np.max(np.abs(prob2 - prob3))
      assert diff12 < 1e-3, "max diff is %.4f" % diff12
      assert diff23 > 1e-3, "max diff is %.4f" % diff23
  
imports: import random
  import numpy
  import pytest
  from packaging.version import Version
  from sklearn import __version__
  from sklearn import exceptions
  from sklearn.base import clone
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import GridSearchCV, cross_val_score
  from sklearn.naive_bayes import GaussianNB
  from sklearn.neighbors import KNeighborsClassifier
  from mlxtend.classifier import EnsembleVoteClassifier
  from mlxtend.data import iris_data
  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