code: def run_error_analyzer(
      model,
      X_test,
      y_test,
      feature_names,
      analyzer_type,
      categorical_features=None,
      tree_features=None,
      max_depth=3,
      num_leaves=31,
      min_child_samples=20,
      filters=None,
      composite_filters=None,
      metric=None,
      model_task=None,
  ):
      if analyzer_type == AnalyzerType.MODEL:
          error_analyzer = ModelAnalyzer(
              model,
              X_test,
              y_test,
              feature_names,
              categorical_features,
              metric=metric,
              model_task=model_task,
          )
      else:
          pred_y = model.predict(X_test)
          error_analyzer = PredictionsAnalyzer(
              pred_y,
              X_test,
              y_test,
              feature_names,
              categorical_features,
              metric=metric,
              model_task=model_task,
          )
      if tree_features is None:
          tree_features = feature_names
  
      # Validate compute_error_tree() output
      tree = error_analyzer.compute_error_tree(
          tree_features,
          filters,
          composite_filters,
          max_depth=max_depth,
          num_leaves=num_leaves,
          min_child_samples=min_child_samples,
      )
      validation_data = X_test.copy()
      if filters is not None or composite_filters is not None:
          validation_data = filter_from_cohort(
              error_analyzer, filters, composite_filters
          )
          validation_data = validation_data.drop(
              columns=[TRUE_Y, ROW_INDEX]
          )
          if not isinstance(X_test, pd.DataFrame):
              validation_data = validation_data.values
      is_regression_task = (
          error_analyzer.model_task == ModelTask.REGRESSION
      )
      model_task_na = error_analyzer.model_task is None
      is_regression_metric = error_analyzer.metric in regression_metrics
      is_regression_metric = model_task_na and is_regression_metric
      is_regression = is_regression_task or is_regression_metric
      validate_error_tree(
          tree, len(validation_data), min_child_samples, is_regression
      )
  
      # validate wrapper method compute_error_tree() output
      new_tree = compute_error_tree(
          error_analyzer,
          tree_features,
          filters,
          composite_filters,
          max_depth=max_depth,
          num_leaves=num_leaves,
          min_child_samples=min_child_samples,
      )
      validate_error_tree(
          new_tree,
          len(validation_data),
          min_child_samples,
          is_regression,
      )
  
      # Validate compute_error_tree_on_dataset() output
      if len(validation_data) > 0:
          dataset = X_test.copy()
          if not isinstance(dataset, pd.DataFrame):
              dataset = pd.DataFrame(
                  data=dataset, columns=tree_features
              )
          dataset[TRUE_Y] = y_test
          dataset[ROW_INDEX] = np.arange(0, len(y_test))
          if analyzer_type == AnalyzerType.PREDICTIONS:
              dataset[PRED_Y] = model.predict(X_test)
      else:
          if isinstance(tree_features, np.ndarray):
              tree_features_list = tree_features.tolist()
          else:
              tree_features_list = tree_features
          if analyzer_type == AnalyzerType.PREDICTIONS:
              dataset = pd.DataFrame(
                  data=[],
                  columns=tree_features_list
                  + [TRUE_Y, ROW_INDEX, PRED_Y],
              )
          else:
              dataset = pd.DataFrame(
                  data=[],
                  columns=tree_features_list + [TRUE_Y, ROW_INDEX],
              )
  
      new_tree = error_analyzer.compute_error_tree_on_dataset(
          tree_features,
          pd.concat([dataset, dataset]),
          max_depth=max_depth,
          num_leaves=num_leaves,
          min_child_samples=min_child_samples,
      )
  
      validate_error_tree(
          new_tree,
          len(pd.concat([dataset, dataset])),
          min_child_samples,
          is_regression,
      )
  
imports: import re
  import time
  from enum import Enum
  import numpy
  import pandas
  import pytest
  from common_utils import replicate_dataset
  from erroranalysis._internal.cohort_filter import filter_from_cohort
  from erroranalysis._internal.constants import ARG, COLUMN, COMPOSITE_FILTERS, DIFF, LEAF_INDEX, METHOD, OPERATION, PRED_Y, ROW_INDEX, SPLIT_FEATURE, SPLIT_INDEX, TRUE_Y, CohortFilterMethods, CohortFilterOps, Metrics, ModelTask, regression_metrics
  from erroranalysis._internal.error_analyzer import ModelAnalyzer, PredictionsAnalyzer
  from erroranalysis._internal.surrogate_error_tree import TreeSide, cache_subtree_features, compute_error_tree, create_surrogate_model, get_categorical_info, get_max_split_index, traverse
  from rai_test_utils.datasets.tabular import create_adult_census_data, create_binary_classification_dataset, create_cancer_data, create_diabetes_data, create_iris_data, create_simple_titanic_data
  from rai_test_utils.models.model_utils import create_models_classification
  from rai_test_utils.models.sklearn import create_kneighbors_classifier, create_sklearn_random_forest_regressor, create_titanic_pipeline
  from raiutils.exceptions import UserConfigValidationException
label_desc: Use image node_id 1 for calling a global function with example usage: run_error_analyzer(model, X_test, y_test, feature_names, analyzer_type, categorical_features, tree_features, max_depth, num_leaves, min_child_samples, filters, composite_filters, metric, model_task) without return types