class_docstr: Check if a dataset is imbalanced by looking at the target variable distribution.
  
  Parameters
  ----------
  n_top_labels: int, default: 5
      Number of labels to show in display graph
  ignore_nan: bool, default True
      Whether to ignore NaN values in the target variable when counting
      the number of unique values.
class_docstr_tok: ["Check","if","a","dataset","is","imbalanced","by","looking","at","the","target","variable","distribution",".","Parameters","--","--","--","--","--","n_top_labels",":","int",",","default",":","5","Number","of","labels","to","show","in","display","graph","ignore_nan",":","bool",",","default","True","Whether","to","ignore","NaN","values","in","the","target","variable","when","counting","the","number","of","unique","values","."]
docstr: Add condition - ratio between least to most frequent labels.
  
  This ratio is compared to class_imbalance_ratio_th.
  
  Parameters
  ----------
  class_imbalance_ratio_th: float, default: 0.1
      threshold for least frequent label to most frequent label.
docstr_tok: ["Add","condition","-","ratio","between","least","to","most","frequent","labels",".","This","ratio","is","compared","to","class_imbalance_ratio_th",".","Parameters","--","--","--","--","--","class_imbalance_ratio_th",":","float",",","default",":","0.1","threshold","for","least","frequent","label","to","most","frequent","label","."]
code: def add_condition_class_ratio_less_than(
      self, class_imbalance_ratio_th: float = 0.1
  ):
      """Add condition - ratio between least to most frequent labels.
  
      This ratio is compared to class_imbalance_ratio_th.
  
      Parameters
      ----------
      class_imbalance_ratio_th: float, default: 0.1
          threshold for least frequent label to most frequent label.
      """
      name = (
          "The ratio between least frequent label to most frequent label "
          f"is less than or equal {class_imbalance_ratio_th}"
      )
  
      def threshold_condition(
          result: t.Dict[Hashable, float]
      ) -> ConditionResult:
          class_ratio = (
              result[list(result.keys())[-1]]
              / result[list(result.keys())[0]]
          )
          details = f"The ratio between least to most frequent label is {format_number(class_ratio)}"
          if class_ratio >= class_imbalance_ratio_th:
              return ConditionResult(ConditionCategory.WARN, details)
  
          return ConditionResult(ConditionCategory.PASS, details)
  
      return self.add_condition(name, threshold_condition)
  
file_path: deepchecks/deepchecks/tabular/checks/data_integrity/class_imbalance.py
imports: import typing
  import plotly.express
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.tabular import Context, SingleDatasetCheck
  from deepchecks.utils.strings import format_number
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 3 for calling the ClassImbalance obj's underlying member method code with example usage: obj.add_condition_class_ratio_less_than(class_imbalance_ratio_th) and returns: self, ConditionResult, ConditionResult