code: def fit(self, series: TimeSeries):
      series = fill_missing_values(series)
      super().fit(series)
      self._assert_univariate(series)
      series = self.training_series
  
      # determine trend
      if self.trend == "poly":
          self.trend_coefficients = np.polyfit(
              range(len(series)),
              series.univariate_values(),
              self.trend_poly_degree,
          )
          self.trend_function = self._poly_trend(
              self.trend_coefficients
          )
      elif self.trend == "exp":
          self.trend_coefficients = np.polyfit(
              range(len(series)), np.log(series.univariate_values()), 1
          )
          self.trend_function = self._exp_trend
      else:
          self.trend_coefficients = None
          self.trend_function = self._null_trend
  
      # subtract trend
      detrended_values = (
          series.univariate_values()
          - self.trend_function(range(len(series)))
      )
      detrended_series = TimeSeries.from_times_and_values(
          series.time_index, detrended_values
      )
  
      # crop training set to match the seasonality of the first prediction point
      if self.required_matches is None:
          curr_required_matches = _find_relevant_timestamp_attributes(
              detrended_series
          )
      else:
          curr_required_matches = self.required_matches
      cropped_series = _crop_to_match_seasons(
          detrended_series, required_matches=curr_required_matches
      )
  
      # perform dft
      self.fft_values = np.fft.fft(cropped_series.univariate_values())
  
      # get indices of `nr_freqs_to_keep` (if a correct value was provided) frequencies with the highest amplitudes
      # by partitioning around the element with sorted index -nr_freqs_to_keep instead of sorting the whole array
      first_n = self.nr_freqs_to_keep
      if (
          first_n is None
          or first_n < 1
          or first_n > len(self.fft_values)
      ):
          first_n = len(self.fft_values)
      self.filtered_indices = np.argpartition(
          abs(self.fft_values), -first_n
      )[-first_n:]
  
      # set all other values in the frequency domain to 0
      self.fft_values_filtered = np.zeros(
          len(self.fft_values), dtype=np.complex_
      )
      self.fft_values_filtered[self.filtered_indices] = self.fft_values[
          self.filtered_indices
      ]
  
      # precompute all possible predicted values using inverse dft
      self.predicted_values = np.fft.ifft(self.fft_values_filtered).real
  
      return self
  
imports: from typing import Callable, Optional
  import numpy
  import pandas
  from statsmodels.tsa.stattools import acf
  from darts.logging import get_logger
  from darts.models.forecasting.forecasting_model import LocalForecastingModel
  from darts.timeseries import TimeSeries
  from darts.utils.missing_values import fill_missing_values
label_desc: Use image node_id 6 for calling the FFT obj's underlying member method code with example usage: obj.fit(series) and returns: self