code: def test_eval_accuracy_from_prediction(self):
      scorer = Norm(component_wise=False)
      # Check return types
      # Check if return type is float when input is a series
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.anomalies, self.test, self.modified_test
          ),
          float,
      )
  
      # Check if return type is Sequence when input is a Sequence of series
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.anomalies, [self.test], self.modified_test
          ),
          Sequence,
      )
  
      # Check if return type is a float when input is a multivariate series and component_wise is set to False
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.anomalies, self.mts_test, self.modified_mts_test
          ),
          float,
      )
  
      # Check if return type is Sequence when input is a multivariate series and component_wise is set to False
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.anomalies, [self.mts_test], self.modified_mts_test
          ),
          Sequence,
      )
  
      scorer = Norm(component_wise=True)
      # Check return types
      # Check if return type is float when input is a series
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.anomalies, self.test, self.modified_test
          ),
          float,
      )
  
      # Check if return type is Sequence when input is a Sequence of series
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.anomalies, [self.test], self.modified_test
          ),
          Sequence,
      )
  
      # Check if return type is a float when input is a multivariate series and component_wise is set to True
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.mts_anomalies, self.mts_test, self.modified_mts_test
          ),
          Sequence,
      )
  
      # Check if return type is Sequence when input is a multivariate series and component_wise is set to True
      assert isinstance(
          scorer.eval_accuracy_from_prediction(
              self.mts_anomalies,
              [self.mts_test],
              self.modified_mts_test,
          ),
          Sequence,
      )
  
      non_fittable_scorer = Norm(component_wise=False)
      fittable_scorer = KMeansScorer(component_wise=False)
      fittable_scorer.fit(self.train)
  
      # if component_wise set to False, 'actual_anomalies' must have widths of 1
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.mts_anomalies, series=self.test
          )
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=[self.anomalies, self.mts_anomalies],
              series=[self.test, self.test],
          )
  
      # 'metric' must be str and "AUC_ROC" or "AUC_PR"
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.anomalies,
              series=self.test,
              metric=1,
          )
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.anomalies,
              series=self.test,
              metric="auc_roc",
          )
      with pytest.raises(TypeError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.anomalies,
              series=self.test,
              metric=["AUC_ROC"],
          )
  
      # 'actual_anomalies' must be binary
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.test, series=self.test
          )
  
      # 'actual_anomalies' must contain anomalies (at least one)
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.only_0_anomalies, series=self.test
          )
  
      # 'actual_anomalies' cannot contain only anomalies
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.only_1_anomalies, series=self.test
          )
  
      # 'actual_anomalies' must match the number of series if length higher than 1
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=[self.anomalies, self.anomalies],
              series=self.test,
          )
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=[self.anomalies, self.anomalies],
              series=[self.test, self.test, self.test],
          )
  
      # 'actual_anomalies' must have non empty intersection with 'series'
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=self.anomalies[:20],
              series=self.test[30:],
          )
      with pytest.raises(ValueError):
          fittable_scorer.eval_accuracy(
              actual_anomalies=[self.anomalies, self.anomalies[:20]],
              series=[self.test, self.test[40:]],
          )
  
      for scorer in [non_fittable_scorer, fittable_scorer]:
          # name must be of type str
          assert type(scorer.__str__()) == str
  
          # 'metric' must be str and "AUC_ROC" or "AUC_PR"
          with pytest.raises(ValueError):
              fittable_scorer.eval_accuracy_from_prediction(
                  actual_anomalies=self.anomalies,
                  actual_series=self.test,
                  pred_series=self.modified_test,
                  metric=1,
              )
          with pytest.raises(ValueError):
              fittable_scorer.eval_accuracy_from_prediction(
                  actual_anomalies=self.anomalies,
                  actual_series=self.test,
                  pred_series=self.modified_test,
                  metric="auc_roc",
              )
          with pytest.raises(TypeError):
              fittable_scorer.eval_accuracy_from_prediction(
                  actual_anomalies=self.anomalies,
                  actual_series=self.test,
                  pred_series=self.modified_test,
                  metric=["AUC_ROC"],
              )
  
          # 'actual_anomalies' must be binary
          with pytest.raises(ValueError):
              scorer.eval_accuracy_from_prediction(
                  actual_anomalies=self.test,
                  actual_series=self.test,
                  pred_series=self.modified_test,
              )
  
          # 'actual_anomalies' must contain anomalies (at least one)
          with pytest.raises(ValueError):
              scorer.eval_accuracy_from_prediction(
                  actual_anomalies=self.only_0_anomalies,
                  actual_series=self.test,
                  pred_series=self.modified_test,
              )
  
          # 'actual_anomalies' cannot contain only anomalies
          with pytest.raises(ValueError):
              scorer.eval_accuracy_from_prediction(
                  actual_anomalies=self.only_1_anomalies,
                  actual_series=self.test,
                  pred_series=self.modified_test,
              )
  
          # 'actual_anomalies' must match the number of series if length higher than 1
          with pytest.raises(ValueError):
              scorer.eval_accuracy_from_prediction(
                  actual_anomalies=[self.anomalies, self.anomalies],
                  actual_series=[self.test, self.test, self.test],
                  pred_series=[
                      self.modified_test,
                      self.modified_test,
                      self.modified_test,
                  ],
              )
          with pytest.raises(ValueError):
              scorer.eval_accuracy_from_prediction(
                  actual_anomalies=[self.anomalies, self.anomalies],
                  actual_series=self.test,
                  pred_series=self.modified_test,
              )
  
          # 'actual_anomalies' must have non empty intersection with 'actual_series' and 'pred_series'
          with pytest.raises(ValueError):
              scorer.eval_accuracy_from_prediction(
                  actual_anomalies=self.anomalies[:20],
                  actual_series=self.test[30:],
                  pred_series=self.modified_test[30:],
              )
          with pytest.raises(ValueError):
              scorer.eval_accuracy_from_prediction(
                  actual_anomalies=[
                      self.anomalies,
                      self.anomalies[:20],
                  ],
                  actual_series=[self.test, self.test[40:]],
                  pred_series=[
                      self.modified_test,
                      self.modified_test[40:],
                  ],
              )
  
imports: from typing import Sequence
  import numpy
  import pytest
  import sklearn
  from pyod.models.knn import KNN
  from scipy.stats import cauchy, expon, gamma, laplace, norm, poisson
  from darts import TimeSeries
  from darts.ad.scorers import CauchyNLLScorer
  from darts.ad.scorers import DifferenceScorer
  from darts.ad.scorers import ExponentialNLLScorer, GammaNLLScorer, GaussianNLLScorer, KMeansScorer, LaplaceNLLScorer
  from darts.ad.scorers import NormScorer
  from darts.ad.scorers import PoissonNLLScorer, PyODScorer, WassersteinScorer
  from darts.models import MovingAverageFilter
label_desc: Use image node_id 3 for calling the TestADAnomalyScorer obj's underlying member method code with example usage: obj.test_eval_accuracy_from_prediction() without return types