class_docstr: Optimal F1 Metric.
  
  Compute the optimal F1 score at the adaptive threshold, based on the F1 metric of the true labels and the
  predicted anomaly scores.
code: def __init__(self, num_classes: int, **kwargs) -> None:
      warnings.warn(
          DeprecationWarning(
              "OptimalF1 metric is deprecated and will be removed in a future release. The optimal F1 score for "
              "Anomalib predictions can be obtained by computing the adaptive threshold with the "
              "AnomalyScoreThreshold metric and setting the computed threshold value in TorchMetrics F1Score metric."
          )
      )
      super().__init__(**kwargs)
  
      self.precision_recall_curve = PrecisionRecallCurve(
          num_classes=num_classes
      )
  
      self.threshold: Tensor
  
file_path: anomalib/src/anomalib/utils/metrics/optimal_f1.py
imports: import warnings
  import torch
  from torch import Tensor
  from torchmetrics import Metric, PrecisionRecallCurve
label_desc: Use image node_id 1 to create a new OptimalF1 object from inherited base classes: Metric with example: obj = OptimalF1(num_classes)