docstr: Filtering-based Anomaly Detection Model
  
  The filtering model may or may not be already fitted. The underlying assumption is that this model
  should be able to adequately filter the series in the absence of anomalies. For this reason,
  it is recommended to either provide a model that has already been fitted and evaluated to work
  appropriately on a series without anomalies, or to ensure that a simple call to the :func:`fit()`
  function of the model will be sufficient to train it to satisfactory performance on series without anomalies.
  
  Calling :func:`fit()` on the anomaly model will fit the underlying filtering model only
  if ``allow_model_training`` is set to ``True`` upon calling ``fit()``.
  In addition, calling :func:`fit()` will also fit the fittable scorers, if any.
  
  Parameters
  ----------
  filter
      A filtering model from Darts that will be used to filter the actual time series
  scorer
      One or multiple scorer(s) that will be used to compare the actual and predicted time series in order
      to obtain an anomaly score ``TimeSeries``.
      If a list of `N` scorer is given, the anomaly model will call each
      one of the scorers and output a list of `N` anomaly scores ``TimeSeries``.
docstr_tok: ["Filtering-based","Anomaly","Detection","Model","The","filtering","model","may","or","may","not","be","already","fitted",".","The","underlying","assumption","is","that","this","model","should","be","able","to","adequately","filter","the","series","in","the","absence","of","anomalies",".","For","this","reason",",","it","is","recommended","to","either","provide","a","model","that","has","already","been","fitted","and","evaluated","to","work","appropriately","on","a","series","without","anomalies",",","or","to","ensure","that","a","simple","call","to","the",":","func",":","`","fit","(",")","`","function","of","the","model","will","be","sufficient","to","train","it","to","satisfactory","performance","on","series","without","anomalies",".","Calling",":","func",":","`","fit","(",")","`","on","the","anomaly","model","will","fit","the","underlying","filtering","model","only","if","``","allow_model_training","``","is","set","to","``","True","``","upon","calling","``","fit","(",")","``",".","In","addition",",","calling",":","func",":","`","fit","(",")","`","will","also","fit","the","fittable","scorers",",","if","any",".","Parameters","--","--","--","--","--","filter","A","filtering","model","from","Darts","that","will","be","used","to","filter","the","actual","time","series","scorer","One","or","multiple","scorer","(","s",")","that","will","be","used","to","compare","the","actual","and","predicted","time","series","in","order","to","obtain","an","anomaly","score","``","TimeSeries","``",".","If","a","list","of","`","N","`","scorer","is","given",",","the","anomaly","model","will","call","each","one","of","the","scorers","and","output","a","list","of","`","N","`","anomaly","scores","``","TimeSeries","``","."]
code: def __init__(
      self,
      model: FilteringModel,
      scorer: Union[AnomalyScorer, Sequence[AnomalyScorer]],
  ):
      """Filtering-based Anomaly Detection Model
  
      The filtering model may or may not be already fitted. The underlying assumption is that this model
      should be able to adequately filter the series in the absence of anomalies. For this reason,
      it is recommended to either provide a model that has already been fitted and evaluated to work
      appropriately on a series without anomalies, or to ensure that a simple call to the :func:`fit()`
      function of the model will be sufficient to train it to satisfactory performance on series without anomalies.
  
      Calling :func:`fit()` on the anomaly model will fit the underlying filtering model only
      if ``allow_model_training`` is set to ``True`` upon calling ``fit()``.
      In addition, calling :func:`fit()` will also fit the fittable scorers, if any.
  
      Parameters
      ----------
      filter
          A filtering model from Darts that will be used to filter the actual time series
      scorer
          One or multiple scorer(s) that will be used to compare the actual and predicted time series in order
          to obtain an anomaly score ``TimeSeries``.
          If a list of `N` scorer is given, the anomaly model will call each
          one of the scorers and output a list of `N` anomaly scores ``TimeSeries``.
      """
  
      raise_if_not(
          isinstance(model, FilteringModel),
          f"`model` must be a darts.models.filtering not a {type(model)}.",
      )
      self.filter = model
  
      super().__init__(model=model, scorer=scorer)
  
file_path: darts/darts/ad/anomaly_model/filtering_am.py
imports: from typing import Dict, Sequence, Union
  from darts.ad.anomaly_model.anomaly_model import AnomalyModel
  from darts.ad.scorers.scorers import AnomalyScorer
  from darts.ad.utils import _assert_same_length, _to_list
  from darts.logging import get_logger, raise_if_not
  from darts.models.filtering.filtering_model import FilteringModel
  from darts.timeseries import TimeSeries
label_desc: Use image node_id 1 to create a new FilteringAnomalyModel object from inherited base classes: AnomalyModel with example: obj = FilteringAnomalyModel(model, scorer)