def _fit_core(
        self,
        series: Sequence[TimeSeries],
        allow_model_training: bool,
        **model_fit_kwargs,
    ):
        """Fit the filters (if applicable) and scorers."""
        # TODO: add support for covariates (see eg. Kalman Filter)
        if allow_model_training and hasattr(self.model, "fit"):
            # TODO: check if filter is already fitted (for now fit it regardless -> only Kalman)
            if len(series) > 1:
                raise_log(
                    ValueError(
                        f"Filter model {self.model.__class__.__name__} can only be fitted "
                        f"on a single time series, but multiple are provided."
                    ),
                    logger=logger,
                )
            self.model.fit(series[0], **model_fit_kwargs)
        else:
            # TODO: check if Kalman is fitted or not
            # if not raise error "fit filter before, or set `allow_model_training` to TRUE"
            pass

        if self.scorers_are_trainable:
            pred = self.predict_series(series)
            # fit the scorers
            self._fit_scorers(series, pred)
Fit the filters (if applicable) and scorers.
darts/ad/anomaly_model/filtering_am.py