automl icon indicating copy to clipboard operation
automl copied to clipboard

Confidence Interval Define Inside MultiSeriesArimaModel.predict_timeseries

Open Boskicl opened this issue 1 year ago • 1 comments

Inside: class MultiSeriesArimaModel(AbstractArimaModel):

There is:

    def predict_timeseries(
        self,
        horizon: int = None,
        include_history: bool = True,
        df: Optional[pd.DataFrame] = None) -> pd.DataFrame:
        """
        Predict target column for given horizon_timedelta and history data.
        :param horizon: Int number of periods to forecast forward.
        :param include_history: Boolean to include the historical dates in the data
            frame for predictions.
        :param df: A pd.Dataframe containing regressors (exogenous variables), if they were used to train the model.
        :return: A pd.DataFrame with the forecast components.
        """
        horizon = horizon or self._horizon
        ids = self._pickled_models.keys()
        preds_dfs = list(map(lambda id_: self._predict_timeseries_single_id(id_, horizon, include_history, df), ids))
        return pd.concat(preds_dfs).reset_index(drop=True)

Which calls: self._predict_timeseries_single_id()

Then calls the original class: ArimaModel()

Which has multiple function calls and eventually:

def _forecast(
    self,
    horizon: int = None,
    X: pd.DataFrame = None) -> pd.DataFrame:
    horizon = horizon or self._horizon
    preds, conf = self.model().predict(
        horizon,
        X=X,
        return_conf_int=True)
    ds_indices = self._get_ds_indices(start_ds=self._end_ds, periods=horizon + 1, frequency=self._frequency)[1:]
    preds_pd = pd.DataFrame({'ds': ds_indices, 'yhat': preds})
    preds_pd[["yhat_lower", "yhat_upper"]] = conf
    return preds_pd

How can I input my own customer Confidence interval? Essentially the conf for the forecast? Why does calling, MultiSeriesArimaModel.predict_timeseries() Not have a confidence input? Why can't I input 90%? or 70%?

Boskicl avatar Mar 08 '24 18:03 Boskicl

All of this is inside model.py at path: automl/blob/main/runtime/databricks/automl_runtime/forecast/pmdarima/model.py

Boskicl avatar Mar 08 '24 19:03 Boskicl