docstr: Handle ludwig functions
  
  Use Ludwig's auto_train engine to train/tune models.
docstr_tok: ["Handle","ludwig","functions","Use","Ludwig","'s","auto_train","engine","to","train\/tune","models","."]
code: def handle_ludwig_function(self):
      """Handle ludwig functions
  
      Use Ludwig's auto_train engine to train/tune models.
      """
      try_to_import_ludwig()
      from ludwig.automl import auto_train
  
      assert (
          len(self.children) == 1
      ), "Create ludwig function expects 1 child, finds {}.".format(
          len(self.children)
      )
  
      aggregated_batch_list = []
      child = self.children[0]
      for batch in child.exec():
          aggregated_batch_list.append(batch)
      aggregated_batch = Batch.concat(aggregated_batch_list, copy=False)
      aggregated_batch.drop_column_alias()
  
      arg_map = {arg.key: arg.value for arg in self.node.metadata}
      start_time = int(time.time())
      auto_train_results = auto_train(
          dataset=aggregated_batch.frames,
          target=arg_map["predict"],
          tune_for_memory=arg_map.get("tune_for_memory", False),
          time_limit_s=arg_map.get(
              "time_limit", DEFAULT_TRAIN_TIME_LIMIT
          ),
          output_directory=self.db.catalog().get_configuration_catalog_value(
              "tmp_dir"
          ),
      )
      train_time = int(time.time()) - start_time
      model_path = os.path.join(
          self.db.catalog().get_configuration_catalog_value(
              "model_dir"
          ),
          self.node.name,
      )
      auto_train_results.best_model.save(model_path)
      best_score = auto_train_results.experiment_analysis.best_result[
          "metric_score"
      ]
      self.node.metadata.append(
          FunctionMetadataCatalogEntry("model_path", model_path)
      )
  
      impl_path = (
          Path(f"{self.function_dir}/ludwig.py").absolute().as_posix()
      )
      io_list = self._resolve_function_io(None)
      return (
          self.node.name,
          impl_path,
          self.node.function_type,
          io_list,
          self.node.metadata,
          best_score,
          train_time,
      )
  
imports: import contextlib
  import hashlib
  import locale
  import os
  import pickle
  import re
  import time
  from pathlib import Path
  from typing import Dict, List
  import numpy
  import pandas
  from evadb.catalog.catalog_utils import get_metadata_properties
  from evadb.catalog.models.function_catalog import FunctionCatalogEntry
  from evadb.catalog.models.function_io_catalog import FunctionIOCatalogEntry
  from evadb.catalog.models.function_metadata_catalog import FunctionMetadataCatalogEntry
  from evadb.configuration.constants import DEFAULT_SKLEARN_TRAIN_MODEL, DEFAULT_TRAIN_REGRESSION_METRIC, DEFAULT_TRAIN_TIME_LIMIT, DEFAULT_XGBOOST_TASK, SKLEARN_SUPPORTED_MODELS, EvaDB_INSTALLATION_DIR
  from evadb.database import EvaDBDatabase
  from evadb.executor.abstract_executor import AbstractExecutor
  from evadb.functions.decorators.utils import load_io_from_function_decorators
  from evadb.models.storage.batch import Batch
  from evadb.plan_nodes.create_function_plan import CreateFunctionPlan
  from evadb.third_party.huggingface.create import gen_hf_io_catalog_entries
  from evadb.utils.errors import FunctionIODefinitionError
  from evadb.utils.generic_utils import load_function_class_from_file, string_comparison_case_insensitive, try_to_import_flaml_automl, try_to_import_ludwig, try_to_import_neuralforecast, try_to_import_statsforecast, try_to_import_torch, try_to_import_ultralytics
  from evadb.utils.logging_manager import logger
label_desc: Use image node_id 3 for calling the CreateFunctionExecutor obj's underlying member method code with example usage: obj.handle_ludwig_function() and returns: self,  impl_path,  self,  io_list,  self,  best_score,  train_time