code: def test_fit_importances(iris_dataset):
      """
      Check whether feature importance is calculated properly.
      """
      (
          (x_train, y_train, x_valid, y_valid),
          _,
          clip_values,
      ) = iris_dataset
  
      def pearson_correlations(x, y):
          correlations = [
              pearsonr(x[:, col], y)[0] for col in range(x.shape[1])
          ]
          absolutes = np.abs(np.array(correlations))
          result = absolutes / np.power(np.sum(absolutes**2), 0.5)
          return result
  
      # Setup classifier
      lr_clf = LogisticRegression(penalty="none")
      lr_clf.fit(x_train, y_train)
      clf_slr = ScikitlearnLogisticRegression(
          model=lr_clf, clip_values=clip_values
      )
  
      # User defined vector
      vector = pearson_correlations(
          np.array(x_train), np.array(y_train)
      )
  
      # 3 different instances of LowProFool, using 3 different ways of specifying importance
  
      # Default version - using pearson correlation under the hood
      lpf_slr_default = LowProFool(
          classifier=clf_slr,
          n_steps=45,
          eta=0.02,
          lambd=1.5,
          importance="pearson",
      )
  
      # Predefined vector, passed in LowProFool initialization
      lpf_slr_vec = LowProFool(
          classifier=clf_slr,
          n_steps=45,
          eta=0.02,
          lambd=1.5,
          importance=vector,
      )
  
      # User defined function
      lpf_slr_fun = LowProFool(
          classifier=clf_slr,
          n_steps=45,
          eta=0.02,
          lambd=1.5,
          importance=pearson_correlations,
      )
  
      lpf_slr_default.fit_importances(x_train, y_train)
      lpf_slr_vec.fit_importances(x_train, y_train)
      lpf_slr_fun.fit_importances(x_train, y_train, normalize=False)
  
      importance_default = lpf_slr_default.importance_vec
      importance_vec_init = lpf_slr_vec.importance_vec
      importance_function = lpf_slr_fun.importance_vec
  
      # Predefined vector passed while fitting
      lpf_slr_default.fit_importances(
          x_train, y_train, importance_array=vector
      )
      importance_vec_fit = lpf_slr_default.importance_vec
  
      # Vector normalization
      vector_norm = vector / np.sum(vector)
  
      is_default_valid = (vector_norm == importance_default).all()
      is_custom_fun_valid = (vector == importance_function).all()
      is_vec_init_valid = (vector_norm == importance_vec_init).all()
      is_vec_fit_valid = (vector_norm == importance_vec_fit).all()
  
      logger.info(
          "[Iris flower, Scikit-learn Logistic Regression] Importance fitting test:"
      )
      if not is_default_valid:
          logger.info("Fitting importance by default is invalid")
      elif not is_custom_fun_valid:
          logger.info(
              "Fitting importance with custom function is invalid"
          )
      elif not is_vec_init_valid:
          logger.info(
              "Fitting importance with vector provided in initializer is invalid"
          )
      elif not is_vec_fit_valid:
          logger.info(
              "Fitting importance with vector provided in fit_importances() is invalid"
          )
      else:
          logger.info(
              "Fitting importance with all available methods went successfully"
          )
  
      assert is_default_valid
      assert is_custom_fun_valid
      assert is_vec_init_valid
      assert is_vec_fit_valid
  
imports: import logging
  import pytest
  import numpy
  import pandas
  import torch
  import torch.nn
  from torch import optim
  from torch.autograd import Variable
  from sklearn import datasets
  from sklearn.preprocessing import StandardScaler
  from sklearn.model_selection import StratifiedShuffleSplit
  from sklearn.linear_model import LogisticRegression
  from sklearn.svm import SVC
  from scipy.stats import pearsonr
  from art.attacks.evasion import LowProFool
  from art.estimators.classification.scikitlearn import ScikitlearnLogisticRegression
  from art.estimators.classification import PyTorchClassifier
  from art.estimators.classification.scikitlearn import ScikitlearnSVC
  from tests.utils import ARTTestException
label_desc: Use image node_id 10 for calling a global function with example usage: test_fit_importances(iris_dataset) and returns: result