code: def infer_type(
      field: FieldInfo, missing_value_percent: float, row_count: int
  ) -> str:
      """Perform type inference on field.
  
      # Inputs
      :param field: (FieldInfo) object describing field
      :param missing_value_percent: (float) percent of missing values in the column
      :param row_count: (int) total number of entries in original dataset
  
      # Return
      :return: (str) feature type
      """
      if field.dtype == DATE or field.dtype.startswith("datetime"):
          return DATE
  
      num_distinct_values = field.num_distinct_values
      distinct_values = field.distinct_values
  
      if num_distinct_values <= 1:
          return CATEGORY
  
      if num_distinct_values == 2 and missing_value_percent == 0:
          # Check that all distinct values are conventional bools.
          if strings_utils.are_conventional_bools(distinct_values):
              return BINARY
  
      if field.image_values >= 3:
          return IMAGE
  
      if field.audio_values >= 3:
          return AUDIO
  
      if strings_utils.are_all_datetimes(distinct_values):
          return DATE
  
      # Use CATEGORY if:
      # - The number of distinct values is significantly less than the total number of examples.
      # - The distinct values are not all numbers.
      # - The distinct values are all numbers but comprise of a perfectly sequential list of integers that suggests the
      #   values represent categories.
      valid_row_count = row_count * (1.0 - missing_value_percent)
      if (
          num_distinct_values
          < valid_row_count
          * CATEGORY_TYPE_DISTINCT_VALUE_PERCENTAGE_CUTOFF
          and (
              (not strings_utils.are_all_numbers(distinct_values))
              or strings_utils.are_sequential_integers(distinct_values)
          )
      ):
          return CATEGORY
  
      # Use NUMBER if all of the distinct values are numbers.
      if strings_utils.are_all_numbers(distinct_values):
          return NUMBER
  
      # TODO (ASN): add other modalities (image, etc. )
      # Fallback to TEXT.
      return TEXT
  
file_path: ludwig/ludwig/utils/automl/type_inference.py
imports: import logging
  from typing import Set
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import AUDIO, BINARY, CATEGORY, DATE, IMAGE, NUMBER, TEXT
  from ludwig.utils import strings_utils
  from ludwig.utils.automl.field_info import FieldInfo
label_desc: Use image node_id 1 for calling a global function with example usage: infer_type(field, missing_value_percent, row_count) and returns: TEXT, DATE, CATEGORY, IMAGE, AUDIO, DATE, CATEGORY, NUMBER, BINARY