docstr: Detect anomalies and score the results against true anomalies.
  
  Parameters
  ----------
  df: pandas DataFrame
      Time series to detect anomalies from.
      If a DataFrame with k columns, k univariate detectors will be
      applied to them independently.
  
  anomaly_true: Series or list
      True anomalies.
  
      - If pandas Series, it is treated as a series of binary labels.
      - If list, a list of events where an event is a pandas Timestamp if
        it is instantaneous or a 2-tuple of pandas Timestamps if it is a
        closed time interval.
  
  scoring: str, optional
      Scoring function to use. Must be one of "recall", "precision",
      "f1", and "iou". See module `metrics` for more information.
      Default: "recall"
  
  **kwargs
      Optional parameters for scoring function. See module `metrics` for
      more information.
  
  Returns
  -------
  float
      Score of detection result.
docstr_tok: ["Detect","anomalies","and","score","the","results","against","true","anomalies",".","Parameters","--","--","--","--","--","df",":","pandas","DataFrame","Time","series","to","detect","anomalies","from",".","If","a","DataFrame","with","k","columns",",","k","univariate","detectors","will","be","applied","to","them","independently",".","anomaly_true",":","Series","or","list","True","anomalies",".","-","If","pandas","Series",",","it","is","treated","as","a","series","of","binary","labels",".","-","If","list",",","a","list","of","events","where","an","event","is","a","pandas","Timestamp","if","it","is","instantaneous","or","a","2-tuple","of","pandas","Timestamps","if","it","is","a","closed","time","interval",".","scoring",":","str",",","optional","Scoring","function","to","use",".","Must","be","one","of","``","recall","''",",","``","precision","''",",","``","f1","''",",","and","``","iou","''",".","See","module","`","metrics","`","for","more","information",".","Default",":","``","recall","''","*","*","kwargs","Optional","parameters","for","scoring","function",".","See","module","`","metrics","`","for","more","information",".","Returns","--","--","--","-","float","Score","of","detection","result","."]
code: def score(
      self,
      df: pd.DataFrame,
      anomaly_true: Union[pd.Series, List, Tuple],
      scoring: str = "recall",
      **kwargs: Any,
  ) -> float:
      """Detect anomalies and score the results against true anomalies.
  
      Parameters
      ----------
      df: pandas DataFrame
          Time series to detect anomalies from.
          If a DataFrame with k columns, k univariate detectors will be
          applied to them independently.
  
      anomaly_true: Series or list
          True anomalies.
  
          - If pandas Series, it is treated as a series of binary labels.
          - If list, a list of events where an event is a pandas Timestamp if
            it is instantaneous or a 2-tuple of pandas Timestamps if it is a
            closed time interval.
  
      scoring: str, optional
          Scoring function to use. Must be one of "recall", "precision",
          "f1", and "iou". See module `metrics` for more information.
          Default: "recall"
  
      **kwargs
          Optional parameters for scoring function. See module `metrics` for
          more information.
  
      Returns
      -------
      float
          Score of detection result.
  
      """
      if scoring == "recall":
          scoring_func = recall  # type: Callable
      elif scoring == "precision":
          scoring_func = precision
      elif scoring == "f1":
          scoring_func = f1_score
      elif scoring == "iou":
          scoring_func = iou
      else:
          raise ValueError(
              "Argument `scoring` must be one of 'recall', 'precision', "
              "'f1' and 'iou'."
          )
      if isinstance(anomaly_true, pd.Series):
          return scoring_func(
              y_true=anomaly_true,
              y_pred=self.detect(df, return_list=False),
              **kwargs,
          )
      else:
          return scoring_func(
              y_true=anomaly_true,
              y_pred=self.detect(df, return_list=True),
              **kwargs,
          )
  
imports: from typing import Any, Callable, Dict, List, Tuple, Union
  import pandas
  from ._base import _NonTrainableUnivariateModel, _TrainableMultivariateModel, _TrainableUnivariateModel
  from .data import to_events
  from .metrics import f1_score, iou, precision, recall
label_desc: Use image node_id 4 for calling the _TrainableMultivariateDetector obj's underlying member method code with example usage: obj.score(df, anomaly_true, scoring) and returns: scoring_func, scoring_func