def score_from_prediction(
        self,
        series: Union[TimeSeries, Sequence[TimeSeries]],
        pred_series: Union[TimeSeries, Sequence[TimeSeries]],
    ) -> Union[TimeSeries, Sequence[TimeSeries]]:
        """Computes the anomaly score on the two (sequence of) series.

        If a pair of sequences is given, they must contain the same number
        of series. The scorer will score each pair of series independently
        and return an anomaly score for each pair.

        Parameters
        ----------
        series:
            The (sequence of) actual series.
        pred_series
            The (sequence of) predicted series.

        Returns
        -------
        Union[TimeSeries, Sequence[TimeSeries]]
            (Sequence of) anomaly score time series
        """
        called_with_single_series = isinstance(series, TimeSeries)
        series, pred_series = series2seq(series), series2seq(pred_series)
        name, pred_name = "series", "pred_series"
        _assert_same_length(series, pred_series, name, pred_name)

        pred_scores = []
        for actual, pred in zip(series, pred_series):
            _sanity_check_two_series(actual, pred, name, pred_name)
            index = actual.slice_intersect_times(pred, copy=False)
            self._check_window_size(index)
            scores = self._score_core_from_prediction(
                vals=actual.slice_intersect_values(pred),
                pred_vals=pred.slice_intersect_values(actual),
            )
            scores = TimeSeries.from_times_and_values(
                values=scores,
                times=index,
            )

            if self.window > 1:
                # apply a moving average with window size `self.window` to the anomaly scores starting at `self.window`;
                # series of length `n` will be transformed into a series of length `n-self.window+1`.
                scores = scores.window_transform(
                    transforms={
                        "window": self.window,
                        "function": "mean",
                        "mode": "rolling",
                        "min_periods": self.window,
                    },
                    treat_na="dropna",
                )
            pred_scores.append(scores)
        return pred_scores[0] if called_with_single_series else pred_scores
Computes the anomaly score on the two (sequence of) series.

        If a pair of sequences is given, they must contain the same number
        of series. The scorer will score each pair of series independently
        and return an anomaly score for each pair.

        Parameters
        ----------
        series:
            The (sequence of) actual series.
        pred_series
            The (sequence of) predicted series.

        Returns
        -------
        Union[TimeSeries, Sequence[TimeSeries]]
            (Sequence of) anomaly score time series
        
darts/ad/scorers/scorers.py