code: def compute_error_tree(
      analyzer,
      features,
      filters,
      composite_filters,
      max_depth=DEFAULT_MAX_DEPTH,
      num_leaves=DEFAULT_NUM_LEAVES,
      min_child_samples=DEFAULT_MIN_CHILD_SAMPLES,
  ):
      """Computes the error tree for the given dataset.
  
      :param analyzer: The error analyzer containing the categorical
          features and categories for the full dataset.
      :type analyzer: BaseAnalyzer
      :param features: The features to train the surrogate model on.
      :type features: numpy.ndarray or pandas.DataFrame
      :param filters: The filters to apply to the dataset.
      :type filters: numpy.ndarray or pandas.DataFrame
      :param composite_filters: The composite filters to apply to the dataset.
      :type composite_filters: numpy.ndarray or pandas.DataFrame
      :param max_depth: The maximum depth of the surrogate tree trained
          on errors.
      :type max_depth: int
      :param num_leaves: The number of leaves of the surrogate tree
          trained on errors.
      :type num_leaves: int
      :param min_child_samples: The minimal number of data required to
          create one leaf.
      :return: The tree representation as a list of nodes.
      :rtype: list[dict[str, str]]
  
      :Example:
  
      An example of running compute_error_tree with a
      filter and a composite filter:
  
      >>> from erroranalysis._internal.error_analyzer import ModelAnalyzer
      >>> from erroranalysis._internal.surrogate_error_tree import (
      ...     compute_error_tree)
      >>> from erroranalysis._internal.constants import ModelTask
      >>> from sklearn.datasets import load_breast_cancer
      >>> from sklearn.model_selection import train_test_split
      >>> from sklearn import svm
      >>> breast_cancer_data = load_breast_cancer()
      >>> feature_names = breast_cancer_data.feature_names
      >>> X_train, X_test, y_train, y_test = train_test_split(
      ...     breast_cancer_data.data, breast_cancer_data.target,
      ...     test_size=0.2, random_state=0)
      >>> categorical_features = []
      >>> clf = svm.SVC(gamma=0.001, C=100., probability=True,
      ...               random_state=777)
      >>> model = clf.fit(X_train, y_train)
      >>> model_task = ModelTask.CLASSIFICATION
      >>> analyzer = ModelAnalyzer(model, X_test, y_test, feature_names,
      ...                          categorical_features, model_task=model_task)
      >>> filters = [{'arg': [23.85], 'column': 'mean radius',
      ...             'method': 'less and equal'}]
      >>> composite_filters = [{'compositeFilters':
      ...                      [{'compositeFilters':
      ...                       [{'arg': [13.45, 22.27],
      ...                         'column': 'mean radius',
      ...                         'method': 'in the range of'},
      ...                        {'arg': [10.88, 24.46],
      ...                         'column': 'mean texture',
      ...                         'method': 'in the range of'}],
      ...                        'operation': 'and'}],
      ...                      'operation': 'or'}]
      >>> tree = compute_error_tree(analyzer, ['mean radius', 'mean texture'],
      ...                           filters, composite_filters)
      """
      # Fit a surrogate model on errors
      filtered_df = filter_from_cohort(
          analyzer, filters, composite_filters
      )
      return compute_error_tree_on_dataset(
          analyzer,
          features,
          filtered_df,
          max_depth=max_depth,
          num_leaves=num_leaves,
          min_child_samples=min_child_samples,
      )
  
imports: import logging
  import numbers
  from enum import Enum
  import numpy
  import pandas
  from lightgbm import Booster, LGBMClassifier, LGBMRegressor
  from sklearn.metrics import mean_absolute_error, mean_squared_error, median_absolute_error, r2_score
  from erroranalysis._internal.cohort_filter import filter_from_cohort
  from erroranalysis._internal.constants import DIFF, LEAF_INDEX, METHOD, PRED_Y, ROW_INDEX, SPLIT_FEATURE, SPLIT_INDEX, TRUE_Y, CohortFilterMethods, Metrics, ModelTask, TreeNode, error_metrics, f1_metrics, metric_to_display_name, precision_metrics, recall_metrics, regression_metrics
  from erroranalysis._internal.metrics import get_ordered_classes, metric_to_func
  from erroranalysis._internal.process_categoricals import process_categoricals
  from erroranalysis._internal.utils import is_spark
  from raiutils.exceptions import UserConfigValidationException
label_desc: Use image node_id 3 for calling a global function with example usage: compute_error_tree(analyzer, features, filters, composite_filters, max_depth, num_leaves, min_child_samples) and returns: compute_error_tree_on_dataset