code: def infer_task_type_by_labels(labels: pd.Series):
      """Infer task type from given dataset/labels/model_classes."""
      # there are no observed labels (user didn't pass model, and datasets have no label column), then we
      # have no task type
      if len(labels) == 0:
          return None
      # Fourth, we check if the observed labels are categorical or not
      if is_categorical(labels, max_categorical_ratio=0.05):
          num_classes = len(labels.dropna().unique())
          task_type = infer_task_type_by_class_number(num_classes)
          if infer_dtype(labels) == "integer":
              get_logger().warning(
                  "Due to the small number of unique labels task type was inferred as %s classification in spite of "
                  "the label column is of type integer. "
                  'Initialize your Dataset with either label_type="%s" or '
                  'label_type="regression" to resolve this warning.',
                  task_type.value,
                  task_type.value,
              )
          return task_type
      else:
          return TaskType.REGRESSION
  
file_path: deepchecks/deepchecks/tabular/utils/task_inference.py
imports: from typing import Optional
  import numpy
  import pandas
  from pandas._libs.lib import infer_dtype
  from deepchecks.core.errors import ValidationError
  from deepchecks.tabular.utils.task_type import TaskType
  from deepchecks.utils.array_math import sequence_to_numpy
  from deepchecks.utils.logger import get_logger
  from deepchecks.utils.type_inference import is_categorical
  from deepchecks.utils.typing import BasicModel
label_desc: Use image node_id 3 for calling a global function with example usage: infer_task_type_by_labels(labels) and returns: None, task_type, TaskType