class_docstr: Base class of Detectors that need training.
class_docstr_tok: ["Base","class","of","Detectors","that","need","training","."]
docstr: Trains the detector on the given time series.
  
  Parameters
  ----------
  series
      Time series to be used to train the detector.
  
  Returns
  -------
  self
      Fitted Detector.
docstr_tok: ["Trains","the","detector","on","the","given","time","series",".","Parameters","--","--","--","--","--","series","Time","series","to","be","used","to","train","the","detector",".","Returns","--","--","--","-","self","Fitted","Detector","."]
code: def fit(
      self, series: Union[TimeSeries, Sequence[TimeSeries]]
  ) -> None:
      """Trains the detector on the given time series.
  
      Parameters
      ----------
      series
          Time series to be used to train the detector.
  
      Returns
      -------
      self
          Fitted Detector.
      """
  
      list_series = (
          [series] if not isinstance(series, Sequence) else series
      )
  
      raise_if_not(
          all([isinstance(s, TimeSeries) for s in list_series]),
          "all series in `series` must be of type TimeSeries.",
      )
  
      raise_if_not(
          all([s.is_deterministic for s in list_series]),
          "all series in `series` must be deterministic (number of samples equal to 1).",
      )
  
      self.width_trained_on = list_series[0].width
  
      raise_if_not(
          all([s.width == self.width_trained_on for s in list_series]),
          "all series in `series` must have the same number of components.",
      )
  
      self._fit_called = True
      return self._fit_core(list_series)
  
file_path: darts/darts/ad/detectors/detectors.py
imports: from abc import ABC, abstractmethod
  from typing import Any, Sequence, Union
  from darts import TimeSeries
  from darts.ad.utils import eval_accuracy_from_binary_prediction
  from darts.logging import raise_if_not
label_desc: Use image node_id 4 for calling the FittableDetector obj's underlying member method code with example usage: obj.fit(series) and returns: self