code: def test_permutation_importance_mixed_types():
      rng = np.random.RandomState(42)
      n_repeats = 4
  
      # Last column is correlated with y
      X = np.array([[1.0, 2.0, 3.0, np.nan], [2, 1, 2, 1]]).T
      y = np.array([0, 1, 0, 1])
  
      clf = make_pipeline(
          SimpleImputer(), LogisticRegression(solver="lbfgs")
      )
      clf.fit(X, y)
      result = permutation_importance(
          clf, X, y, n_repeats=n_repeats, random_state=rng
      )
  
      assert result.importances.shape == (X.shape[1], n_repeats)
  
      # the correlated feature with y is the last column and should
      # have the highest importance
      assert np.all(
          result.importances_mean[-1] > result.importances_mean[:-1]
      )
  
      # use another random state
      rng = np.random.RandomState(0)
      result2 = permutation_importance(
          clf, X, y, n_repeats=n_repeats, random_state=rng
      )
      assert result2.importances.shape == (X.shape[1], n_repeats)
  
      assert not np.allclose(result.importances, result2.importances)
  
      # the correlated feature with y is the last column and should
      # have the highest importance
      assert np.all(
          result2.importances_mean[-1] > result2.importances_mean[:-1]
      )
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose
  from sklearn.compose import ColumnTransformer
  from sklearn.datasets import load_diabetes, load_iris, make_classification, make_regression
  from sklearn.dummy import DummyClassifier
  from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
  from sklearn.impute import SimpleImputer
  from sklearn.inspection import permutation_importance
  from sklearn.linear_model import LinearRegression, LogisticRegression
  from sklearn.metrics import get_scorer, mean_squared_error, r2_score
  from sklearn.model_selection import train_test_split
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import KBinsDiscretizer, OneHotEncoder, StandardScaler, scale
  from sklearn.utils import parallel_backend
  from sklearn.utils._testing import _convert_container
label_desc: Use image node_id 4 for calling a global function with example usage: test_permutation_importance_mixed_types() without return types