class_docstr: `LowProFool` attack.
  
  | Paper link: https://arxiv.org/abs/1911.03274
class_docstr_tok: ["`","LowProFool","`","attack",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1911.03274"]
docstr: This function calculates feature importances using a specified built-in function or applies a provided custom
  function (callable object). It calculates those values on the passed training data.
  
  :param x: Design matrix of the dataset used to train the classifier.
  :param y: Labels of the dataset used to train the classifier.
  :return: None.
docstr_tok: ["This","function","calculates","feature","importances","using","a","specified","built-in","function","or","applies","a","provided","custom","function","(","callable","object",")",".","It","calculates","those","values","on","the","passed","training","data",".",":","param","x",":","Design","matrix","of","the","dataset","used","to","train","the","classifier",".",":","param","y",":","Labels","of","the","dataset","used","to","train","the","classifier",".",":","return",":","None","."]
code: def __calculate_feature_importances(
      self, x: np.ndarray, y: np.ndarray
  ) -> None:
      """
      This function calculates feature importances using a specified built-in function or applies a provided custom
      function (callable object). It calculates those values on the passed training data.
  
      :param x: Design matrix of the dataset used to train the classifier.
      :param y: Labels of the dataset used to train the classifier.
      :return: None.
      """
      if self.importance == "pearson":
          # Apply a simple Pearson correlation calculation.
          pearson_correlations = [
              pearsonr(x[:, col], y)[0] for col in range(x.shape[1])
          ]
          absolutes = np.abs(np.array(pearson_correlations))
          self.importance_vec = absolutes / np.power(
              np.sum(absolutes**2), 0.5
          )
  
      elif callable(self.importance):  # pragma: no cover
          # Apply a custom function to call on the provided data.
          try:
              self.importance_vec = np.array(self.importance(x, y))
          except Exception as exception:
              logger.exception(
                  "Provided importance function has failed."
              )
              raise exception
  
          if not isinstance(self.importance_vec, np.ndarray):
              self.importance_vec = None
              raise TypeError(
                  "Feature importance vector should be of type np.ndarray or any convertible to that."
              )
          if self.importance_vec.shape != (self.n_features,):
              self.importance_vec = None
              raise ValueError(
                  "Feature has to be one-dimensional array of size (n_features, )."
              )
  
      else:  # pragma: no cover
          raise TypeError(
              f"Unrecognized feature importance function: {self.importance}"
          )
  
imports: import logging
  from typing import Callable, Optional, Union, TYPE_CHECKING
  import numpy
  from scipy.stats import pearsonr
  from tqdm.auto import trange
  from art.attacks.attack import EvasionAttack
  from art.estimators.estimator import LossGradientsMixin
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification.classifier import ClassifierMixin
label_desc: Use image node_id 6 for calling the LowProFool obj's underlying member method code with example usage: obj.__calculate_feature_importances(x, y) without return types