def test_fit_kwargs(self):
        """Using kwargs to pass additional parameters to the fit()"""
        # using default optimization method
        model = ExponentialSmoothing()
        model.fit(self.series)
        assert model.fit_kwargs == {}
        pred = model.predict(n=2)

        model_bis = ExponentialSmoothing()
        model_bis.fit(self.series)
        assert model_bis.fit_kwargs == {}
        pred_bis = model_bis.predict(n=2)

        # two methods with the same parameters should yield the same forecasts
        assert pred.time_index.equals(pred_bis.time_index)
        np.testing.assert_array_almost_equal(pred.values(), pred_bis.values())

        # change optimization method
        model_ls = ExponentialSmoothing(method="least_squares")
        model_ls.fit(self.series)
        assert model_ls.fit_kwargs == {"method": "least_squares"}
        pred_ls = model_ls.predict(n=2)

        # forecasts should be slightly different
        assert pred.time_index.equals(pred_ls.time_index)
        assert all(np.not_equal(pred.values(), pred_ls.values()))
Using kwargs to pass additional parameters to the fit()
darts/tests/models/forecasting/test_exponential_smoothing.py