class_docstr: Drops features which only have 1 unique value or which have nearly no repeated values (based on max_unique_ratio) and are of category or object type.
class_docstr_tok: ["Drops","features","which","only","have","1","unique","value","or","which","have","nearly","no","repeated","values","(","based","on","max_unique_ratio",")","and","are","of","category","or","object","type","."]
code: def _drop_unique_features(
      X: DataFrame, feature_metadata: FeatureMetadata, max_unique_ratio
  ) -> list:
      features_to_drop = []
      X_len = len(X)
      max_unique_value_count = X_len * max_unique_ratio
      for column in X:
          unique_value_count = len(X[column].unique())
          # Drop features that are always the same
          if unique_value_count == 1:
              features_to_drop.append(column)
          elif feature_metadata.get_feature_type_raw(column) in [
              R_CATEGORY,
              R_OBJECT,
          ] and (unique_value_count > max_unique_value_count):
              special_types = (
                  feature_metadata.get_feature_types_special(column)
              )
              if S_TEXT in special_types:
                  # We should not drop a text column
                  continue
              elif S_IMAGE_PATH in special_types:
                  # We should not drop an image path column
                  continue
              elif S_IMAGE_BYTEARRAY in special_types:
                  # We should not drop an image bytearray column
                  continue
              else:
                  features_to_drop.append(column)
      return features_to_drop
  
file_path: autogluon/features/src/autogluon/features/generators/drop_unique.py
imports: import logging
  from pandas import DataFrame
  from autogluon.common.features.feature_metadata import FeatureMetadata
  from autogluon.common.features.types import R_CATEGORY, R_OBJECT, S_IMAGE_BYTEARRAY, S_IMAGE_PATH, S_TEXT
  from .abstract import AbstractFeatureGenerator
label_desc: Use image node_id 5 for calling the DropUniqueFeatureGenerator obj's underlying member method code with example usage: obj._drop_unique_features(X, feature_metadata, max_unique_ratio) and returns: features_to_drop