class_docstr: Find new labels in test.
  
  Parameters
  ----------
  n_samples : int , default: 10_000_000
      number of samples to use for this check.
  random_state : int, default: 42
      random seed for all check internals.
class_docstr_tok: ["Find","new","labels","in","test",".","Parameters","--","--","--","--","--","n_samples",":","int",",","default",":","10_000_000","number","of","samples","to","use","for","this","check",".","random_state",":","int",",","default",":","42","random","seed","for","all","check","internals","."]
docstr: Add condition - require label column's ratio of new label samples to be less or equal to the threshold.
  
  Parameters
  ----------
  max_ratio : float , default: 0
      Ratio of new label samples to total samples which is the maximum allowed.
docstr_tok: ["Add","condition","-","require","label","column","'s","ratio","of","new","label","samples","to","be","less","or","equal","to","the","threshold",".","Parameters","--","--","--","--","--","max_ratio",":","float",",","default",":","0","Ratio","of","new","label","samples","to","total","samples","which","is","the","maximum","allowed","."]
code: def add_condition_new_label_ratio_less_or_equal(
      self, max_ratio: float = 0
  ):
      """Add condition - require label column's ratio of new label samples to be less or equal to the threshold.
  
      Parameters
      ----------
      max_ratio : float , default: 0
          Ratio of new label samples to total samples which is the maximum allowed.
      """
  
      def new_category_count_condition(result: Dict) -> ConditionResult:
          if result:
              new_labels = result["new_labels"]
              new_label_ratio = (
                  result["n_new_labels_samples"] / result["n_samples"]
              )
              details = f"Found {format_percent(new_label_ratio)} of labels in test data are new labels: {new_labels}"
              category = (
                  ConditionCategory.PASS
                  if new_label_ratio <= max_ratio
                  else ConditionCategory.FAIL
              )
              return ConditionResult(category, details)
          return ConditionResult(
              ConditionCategory.PASS, "No new labels found"
          )
  
      return self.add_condition(
          f"Ratio of samples with new label is less or equal to {format_percent(max_ratio)}",
          new_category_count_condition,
      )
  
file_path: deepchecks/deepchecks/tabular/checks/train_test_validation/new_label_train_test.py
imports: from typing import Dict
  import pandas
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.core.reduce_classes import ReduceLabelMixin
  from deepchecks.tabular import Context, TrainTestCheck
  from deepchecks.utils.strings import format_percent
label_desc: Use image node_id 6 for calling the NewLabelTrainTest obj's underlying member method code with example usage: obj.add_condition_new_label_ratio_less_or_equal(max_ratio) and returns: self, ConditionResult, ConditionResult