code: def run_error_analyzer(
      model,
      X_test,
      y_test,
      feature_names,
      categorical_features,
      metric=Metrics.ERROR_RATE,
  ):
      model_analyzer = ModelAnalyzer(
          model,
          X_test,
          y_test,
          feature_names,
          categorical_features,
          metric=metric,
      )
      root_stats = model_analyzer.compute_root_stats()
      metric_name = metric_to_display_name[metric]
  
      total = len(X_test)
  
      assert root_stats[RootKeys.METRIC_NAME] == metric_name
      assert root_stats[RootKeys.TOTAL_SIZE] == total
      assert root_stats[RootKeys.ERROR_COVERAGE] == 100
  
      if metric == Metrics.ERROR_RATE:
          diff = model_analyzer.get_diff()
          error = sum(diff)
          metric_value = (error / total) * 100
      else:
          metric_func = metric_to_func[metric]
          metric_value = metric_func(
              model_analyzer.pred_y, model_analyzer.true_y
          )
  
      assert root_stats[RootKeys.METRIC_VALUE] == metric_value
  
file_path: responsible-ai-toolbox/erroranalysis/tests/test_root_stats.py
imports: import pytest
  from erroranalysis._internal.constants import Metrics, RootKeys, metric_to_display_name
  from erroranalysis._internal.error_analyzer import ModelAnalyzer
  from erroranalysis._internal.metrics import metric_to_func
  from rai_test_utils.datasets.tabular import create_binary_classification_dataset, create_cancer_data, create_housing_data, create_iris_data, create_simple_titanic_data
  from rai_test_utils.models.model_utils import create_models_classification, create_models_regression
  from rai_test_utils.models.sklearn import create_titanic_pipeline
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, categorical_features, metric) without return types