def __init__(
        self,
        model: _TS,
        add_encoders: Optional[dict] = None,
        quantiles: Optional[list[float]] = None,
        random_state: Optional[int] = None,
    ):
        """StatsForecast Model.

        Can be used to fit any `StatsForecast` base model. For more information on available models, see the
        `StatsForecast package <https://nixtlaverse.nixtla.io/statsforecast/index.html>`_.

        In addition to univariate deterministic forecasting, our `StatsForecastModel` comes with additional support:

        - **Future covariates:** Use exogenous features to potentially improve predictive accuracy.

          - It either uses the base model's native exogenous features, or

          - It adds future covariates support by first regressing the series against the future covariates using a
            :class:`~darts.models.forecasting.linear_regression_model.LinearRegressionModel` model and then running the
            StatsForecast model on the in-sample residuals from this original regression. This approach was inspired by
            `this post of Stephan Kolassa <https://stats.stackexchange.com/q/220885>`_.

        - **Probabilstic forecasting:** Some base models might require setting `prediction_intervals` at `model`
          creation to support probabilistic forecasting. To generate probabilistic forecasts, you can set the following
          parameters when calling :meth:`~darts.models.forecasting.sf_model.StatsForecastModel.predict`:

          - Forecast quantile values directly by setting `predict_likelihood_parameters=True`.

          - Generate sampled forecasts from these quantiles by setting `num_samples >> 1`.

        - **Conformal prediction:** In addition to the native probabilistic support, you can perform conformal
          prediction / forecasting by setting `prediction_intervals` at model creation. Then predict the in the same
          way as described above.

        - **Transferable series forecasting:** Apply the fitted model to a new input `series` at prediction time.

          - It either uses the base model's native transferrable series support (StatsForecast models that support the
            `forward()` method), or

          - It adds support by first fitting a copy of the model on the new series, and then using that model to
            generate the corresponding forecast.

        .. note::
            Future covariates are not supported when the input series contain missing values.

        Parameters
        ----------
        model
            Any StatsForecast model.
        add_encoders
            A large number of future covariates can be automatically generated with `add_encoders`.
            This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that
            will be used as index encoders. Additionally, a transformer such as Darts' :class:`Scaler` can be added to
            transform the generated covariates. This happens all under one hood and only needs to be specified at
            model creation.
            Read :meth:`SequentialEncoder <darts.dataprocessing.encoders.SequentialEncoder>` to find out more about
            ``add_encoders``. Default: ``None``. An example showing some of ``add_encoders`` features:

            .. highlight:: python
            .. code-block:: python

                def encode_year(idx):
                    return (idx.year - 1950) / 50

                add_encoders={
                    'cyclic': {'future': ['month']},
                    'datetime_attribute': {'future': ['hour', 'dayofweek']},
                    'position': {'future': ['relative']},
                    'custom': {'future': [encode_year]},
                    'transformer': Scaler(),
                    'tz': 'CET'
                }
            ..
        quantiles
            Optionally, produce quantile predictions at `quantiles` levels when performing probabilistic forecasting
            with `num_samples > 1` or `predict_likelihood_parameters=True`.
        random_state
            Controls the randomness for reproducible forecasting.

        Examples
        --------
        >>> from darts.datasets import AirPassengersDataset
        >>> from darts.models import StatsForecastModel
        >>> from darts.utils.timeseries_generation import datetime_attribute_timeseries
        >>> from statsforecast.models import AutoARIMA
        >>> series = AirPassengersDataset().load()
        >>> # optionally, use some future covariates; e.g. the value of the month encoded as a sine and cosine series
        >>> future_cov = datetime_attribute_timeseries(series, "month", cyclic=True, add_length=6)
        >>> # define AutoARIMA parameters
        >>> model = StatsForecastModel(model=AutoARIMA(season_length=12))
        >>> model.fit(series, future_covariates=future_cov)
        >>> pred = model.predict(6, future_covariates=future_cov)
        >>> pred.values()
        array([[445.4276575 ],
               [420.04912881],
               [448.7142377 ],
               [491.23406559],
               [502.67834069],
               [566.04774778]])
        """
        if not isinstance(model, _TS):
            raise ValueError(
                "`model` must be a StatsForecast model imported from `statsforecast.models`."
            )
        self.model: _SFModel = model
        self._likelihood = QuantilePrediction(quantiles=quantiles)

        # future covariates support can be added through the use of a linear model
        self._linreg: Optional[LinearRegressionModel] = None
        super().__init__(add_encoders=add_encoders)
StatsForecast Model.

        Can be used to fit any `StatsForecast` base model. For more information on available models, see the
        `StatsForecast package <https://nixtlaverse.nixtla.io/statsforecast/index.html>`_.

        In addition to univariate deterministic forecasting, our `StatsForecastModel` comes with additional support:

        - **Future covariates:** Use exogenous features to potentially improve predictive accuracy.

          - It either uses the base model's native exogenous features, or

          - It adds future covariates support by first regressing the series against the future covariates using a
            :class:`~darts.models.forecasting.linear_regression_model.LinearRegressionModel` model and then running the
            StatsForecast model on the in-sample residuals from this original regression. This approach was inspired by
            `this post of Stephan Kolassa <https://stats.stackexchange.com/q/220885>`_.

        - **Probabilstic forecasting:** Some base models might require setting `prediction_intervals` at `model`
          creation to support probabilistic forecasting. To generate probabilistic forecasts, you can set the following
          parameters when calling :meth:`~darts.models.forecasting.sf_model.StatsForecastModel.predict`:

          - Forecast quantile values directly by setting `predict_likelihood_parameters=True`.

          - Generate sampled forecasts from these quantiles by setting `num_samples >> 1`.

        - **Conformal prediction:** In addition to the native probabilistic support, you can perform conformal
          prediction / forecasting by setting `prediction_intervals` at model creation. Then predict the in the same
          way as described above.

        - **Transferable series forecasting:** Apply the fitted model to a new input `series` at prediction time.

          - It either uses the base model's native transferrable series support (StatsForecast models that support the
            `forward()` method), or

          - It adds support by first fitting a copy of the model on the new series, and then using that model to
            generate the corresponding forecast.

        .. note::
            Future covariates are not supported when the input series contain missing values.

        Parameters
        ----------
        model
            Any StatsForecast model.
        add_encoders
            A large number of future covariates can be automatically generated with `add_encoders`.
            This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that
            will be used as index encoders. Additionally, a transformer such as Darts' :class:`Scaler` can be added to
            transform the generated covariates. This happens all under one hood and only needs to be specified at
            model creation.
            Read :meth:`SequentialEncoder <darts.dataprocessing.encoders.SequentialEncoder>` to find out more about
            ``add_encoders``. Default: ``None``. An example showing some of ``add_encoders`` features:

            .. highlight:: python
            .. code-block:: python

                def encode_year(idx):
                    return (idx.year - 1950) / 50

                add_encoders={
                    'cyclic': {'future': ['month']},
                    'datetime_attribute': {'future': ['hour', 'dayofweek']},
                    'position': {'future': ['relative']},
                    'custom': {'future': [encode_year]},
                    'transformer': Scaler(),
                    'tz': 'CET'
                }
            ..
        quantiles
            Optionally, produce quantile predictions at `quantiles` levels when performing probabilistic forecasting
            with `num_samples > 1` or `predict_likelihood_parameters=True`.
        random_state
            Controls the randomness for reproducible forecasting.

        Examples
        --------
        >>> from darts.datasets import AirPassengersDataset
        >>> from darts.models import StatsForecastModel
        >>> from darts.utils.timeseries_generation import datetime_attribute_timeseries
        >>> from statsforecast.models import AutoARIMA
        >>> series = AirPassengersDataset().load()
        >>> # optionally, use some future covariates; e.g. the value of the month encoded as a sine and cosine series
        >>> future_cov = datetime_attribute_timeseries(series, "month", cyclic=True, add_length=6)
        >>> # define AutoARIMA parameters
        >>> model = StatsForecastModel(model=AutoARIMA(season_length=12))
        >>> model.fit(series, future_covariates=future_cov)
        >>> pred = model.predict(6, future_covariates=future_cov)
        >>> pred.values()
        array([[445.4276575 ],
               [420.04912881],
               [448.7142377 ],
               [491.23406559],
               [502.67834069],
               [566.04774778]])
        
darts/models/forecasting/sf_model.py