class_docstr: BaseAnalyzer Class, used by ModelAnalyzer and PredictionsAnalyzer.
  
  BaseAnalyzer class is the common base class for the ModelAnalyzer
  and PredictionsAnalyzer classes.
  
  :param dataset:  A matrix of feature vector examples
      (# examples x # features).
  :type dataset: numpy.ndarray or list[][] or pandas.DataFrame
  :param true_y: The true labels for the provided dataset.
  :type true_y: numpy.ndarray or list[] or pandas.Series
  :param feature_names: Feature names.
  :type feature_names: numpy.ndarray or list[]
  :param categorical_features: The categorical feature names.
  :type categorical_features: list[str]
  :param model_task: Optional parameter to specify whether the model
      is a classification or regression model. In most cases, the
      type of the model can be inferred based on the shape of the
      output, where a classifier has a predict_proba method and
      outputs a 2 dimensional array, while a regressor has a
      predict method and outputs a 1 dimensional array.
  :type model_task: str
  :param metric: The metric name to evaluate at each tree node or
      heatmap grid.  Currently supported classification metrics
      include 'error_rate', 'recall_score' for binary
      classification and 'micro_recall_score' or
      'macro_recall_score' for multiclass classification,
      'precision_score' for binary classification and
      'micro_precision_score' or 'macro_precision_score'
      for multiclass classification, 'f1_score' for binary
      classification and 'micro_f1_score' or 'macro_f1_score'
      for multiclass classification, and 'accuracy_score'.
      Supported regression metrics include 'mean_absolute_error',
      'mean_squared_error', 'r2_score', and 'median_absolute_error'.
  :type metric: str
  :param classes: The class names.
  :type classes: numpy.ndarray or list[]
docstr: Compute the importances or correlation between features and error.
  
  Computes the feature importances or the correlation between
  each of the features in the dataset and the error from the label
  and prediction columns.  Uses mutual information, specifically
  uses the scikit-learn methods mutual_info_classif for classification
  and mutual_info_regression for regression tasks.
  
  :param error_correlation_method: Method to compute error correlation.
  :type error_correlation_method: str
  :return: The computed importances or correlation between the
      features and error.
  :rtype: list[float]
docstr_tok: ["Compute","the","importances","or","correlation","between","features","and","error",".","Computes","the","feature","importances","or","the","correlation","between","each","of","the","features","in","the","dataset","and","the","error","from","the","label","and","prediction","columns",".","Uses","mutual","information",",","specifically","uses","the","scikit-learn","methods","mutual_info_classif","for","classification","and","mutual_info_regression","for","regression","tasks",".",":","param","error_correlation_method",":","Method","to","compute","error","correlation",".",":","type","error_correlation_method",":","str",":","return",":","The","computed","importances","or","correlation","between","the","features","and","error",".",":","rtype",":","list","[","float","]"]
code: def compute_importances(self, error_correlation_method=MUTUAL_INFO):
      """Compute the importances or correlation between features and error.
  
      Computes the feature importances or the correlation between
      each of the features in the dataset and the error from the label
      and prediction columns.  Uses mutual information, specifically
      uses the scikit-learn methods mutual_info_classif for classification
      and mutual_info_regression for regression tasks.
  
      :param error_correlation_method: Method to compute error correlation.
      :type error_correlation_method: str
      :return: The computed importances or correlation between the
          features and error.
      :rtype: list[float]
      """
      input_data = self.dataset
      diff = self.get_diff()
      if isinstance(self.dataset, pd.DataFrame):
          input_data = input_data.to_numpy(copy=True)
      if self.categorical_features:
          # Inplace replacement of columns
          indexes = self.categorical_indexes
          string_ind_data = self.string_indexed_data
          for idx, c_i in enumerate(indexes):
              input_data[:, c_i] = string_ind_data[:, idx]
      # for very large number of rows mutual information
      # will be very expensive to compute, hence we sample
      num_rows = input_data.shape[0]
      if num_rows > IMPORTANCES_THRESHOLD:
          indexes = generate_random_unique_indexes(
              num_rows, IMPORTANCES_THRESHOLD
          )
          input_data = input_data[indexes]
          diff = diff[indexes]
      try:
          importances = self._compute_error_correlation(
              input_data, diff, error_correlation_method
          )
      except ValueError:
          # Impute input_data if it contains NaNs, infinity or a value too
          # large for dtype('float64')
          input_data = np.nan_to_num(input_data.astype(float))
          importances = self._compute_error_correlation(
              input_data, diff, error_correlation_method
          )
      return importances
  
imports: import logging
  from abc import ABC, abstractmethod
  import numpy
  import pandas
  from sklearn.feature_selection import mutual_info_classif, mutual_info_regression
  from erroranalysis._internal.constants import ErrorCorrelationMethods, MatrixParams, Metrics, ModelTask, RootKeys, metric_to_display_name
  from erroranalysis._internal.matrix_filter import compute_matrix
  from erroranalysis._internal.matrix_filter import compute_matrix_on_dataset
  from erroranalysis._internal.metrics import metric_to_func
  from erroranalysis._internal.process_categoricals import process_categoricals
  from erroranalysis._internal.surrogate_error_tree import compute_error_tree
  from erroranalysis._internal.surrogate_error_tree import compute_error_tree_on_dataset
  from erroranalysis._internal.utils import generate_random_unique_indexes
  from erroranalysis._internal.version_checker import check_pandas_version
  from erroranalysis.error_correlation_methods import compute_ebm_global_importance, compute_gbm_global_importance
  from erroranalysis.report import ErrorReport
label_desc: Use image node_id 18 for calling the BaseAnalyzer obj's underlying member method code with example usage: obj.compute_importances(error_correlation_method) and returns: importances