code: def compute_and_plot(
      model,
      X_validation,
      y_validation,
      model_file_path,
      learner_name,
      metric_name=None,
      ml_task=None,
      n_jobs=-1,
  ):
      # for scoring check https://scikit-learn.org/stable/modules/model_evaluation.html#scoring-parameter
      if ml_task == BINARY_CLASSIFICATION:
          scoring = log_loss_scorer
      elif ml_task == MULTICLASS_CLASSIFICATION:
          scoring = log_loss_scorer
      else:
          scoring = "neg_mean_squared_error"
  
      try:
          with warnings.catch_warnings():
              warnings.simplefilter("ignore")
              # subsample validation data to speed-up importance computation
              # in the case of large number of columns, it can take a lot of time
              rows, cols = X_validation.shape
              if cols > 5000 and rows > 100:
                  X_vald, _, y_vald, _ = subsample(
                      X_validation,
                      y_validation,
                      train_size=100,
                      ml_task=ml_task,
                  )
              elif cols > 50 and rows * cols > 200000 and rows > 1000:
                  X_vald, _, y_vald, _ = subsample(
                      X_validation,
                      y_validation,
                      train_size=1000,
                      ml_task=ml_task,
                  )
              else:
                  X_vald = X_validation
                  y_vald = y_validation
  
              importance = permutation_importance(
                  model,
                  X_vald,
                  y_vald,
                  scoring=scoring,
                  n_jobs=n_jobs,
                  random_state=12,
                  n_repeats=5,  # default
              )
  
          sorted_idx = importance["importances_mean"].argsort()
  
          # save detailed importance
          df_imp = pd.DataFrame(
              {
                  "feature": X_vald.columns[sorted_idx],
                  "mean_importance": importance["importances_mean"][
                      sorted_idx
                  ],
              }
          )
          df_imp.to_csv(
              os.path.join(
                  model_file_path, f"{learner_name}_importance.csv"
              ),
              index=False,
          )
      except Exception as e:
          print(str(e))
          print(
              "Problem during computing permutation importance. Skipping ..."
          )
  
file_path: mljar-supervised/supervised/utils/importance.py
imports: import json
  import logging
  import os
  import warnings
  import matplotlib.pyplot
  import numpy
  import pandas
  from sklearn.inspection import permutation_importance
  from supervised.algorithms.registry import BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION
  from supervised.utils.subsample import subsample
  from supervised.utils.config import LOG_LEVEL
  import sys
  from sklearn.metrics import log_loss, make_scorer
label_desc: Use image node_id 1 for calling the PermutationImportance obj's underlying member method code with example usage: obj.compute_and_plot(model, X_validation, y_validation, model_file_path, learner_name, metric_name, ml_task, n_jobs) without return types