code: def calculate_metafeatures(task_id):
      (
          X_train,
          y_train,
          X_test,
          y_test,
          cat,
          task_type,
          dataset_name,
      ) = load_task(task_id)
      stopwatch = StopWatch()
  
      if task_type == "classification":
          if len(np.unique(y_train)) == 2:
              task_type = BINARY_CLASSIFICATION
          else:
              task_type = MULTICLASS_CLASSIFICATION
      else:
          task_type = REGRESSION
  
      _metafeatures_labels = _calculate_metafeatures(
          x_train=X_train,
          y_train=y_train,
          data_feat_type=cat,
          data_info_task=task_type,
          basename=dataset_name,
          logger_=logger,
          stopwatch=stopwatch,
      )
  
      _metafeatures_encoded_labels = _calculate_metafeatures_encoded(
          x_train=X_train,
          y_train=y_train,
          data_feat_type=cat,
          task=task_type,
          basename=dataset_name,
          logger_=logger,
          stopwatch=stopwatch,
      )
  
      mf = _metafeatures_labels
      mf.metafeature_values.update(
          _metafeatures_encoded_labels.metafeature_values
      )
  
      return mf
  
file_path: auto-sklearn/scripts/03_calculate_metafeatures.py
imports: from argparse import ArgumentParser
  from collections import defaultdict, OrderedDict
  import copy
  import logging
  import os
  import sys
  import unittest.mock
  import tempfile
  import arff
  import joblib
  import numpy
  import pandas
  from autosklearn.constants import BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION
  from autosklearn.metalearning.metafeatures import metafeatures
  from autosklearn.smbo import _calculate_metafeatures, _calculate_metafeatures_encoded, EXCLUDE_META_FEATURES_REGRESSION, EXCLUDE_META_FEATURES_CLASSIFICATION
  from autosklearn.util.stopwatch import StopWatch
  from update_metadata_util import load_task, classification_tasks, regression_tasks
label_desc: Use image node_id 1 for calling a global function with example usage: calculate_metafeatures(task_id) and returns: mf