Exemple #1
0
    def _compute_pred_errors(self, alpha=DEFAULT_ALPHA):
        """
        Get the prediction errors for the forecast.
        """
        self.check_is_fitted()
        alpha = check_alpha(alpha)

        n_timepoints = len(self.oh)

        self.sigma_ = np.sqrt(self._fitted_forecaster.sse / (n_timepoints - 1))
        sem = self.sigma_ * np.sqrt(self._fh * self.smoothing_level_ ** 2 + 1)

        errors = []
        for a in alpha:
            z = zscore(1 - a)
            error = z * sem
            errors.append(
                pd.Series(error, index=self.fh.absolute(self.cutoff)))

        # for a single alpha value, unwrap list
        if len(errors) == 1:
            return errors[0]

        # otherwise, return list of errors
        return errors
Exemple #2
0
    def _compute_pred_err(self, alphas):
        """
        Get the prediction errors for the forecast.
        """
        self.check_is_fitted()

        n_timepoints = len(self._y)

        self.sigma_ = np.sqrt(self._fitted_forecaster.sse / (n_timepoints - 1))
        sem = self.sigma_ * np.sqrt(self._fh * self.smoothing_level_ ** 2 + 1)

        errors = []
        for alpha in alphas:
            z = zscore(1 - alpha)
            error = z * sem
            errors.append(
                pd.Series(error, index=self.fh.absolute(self.cutoff)))

        return errors