.. index:: single: exponential_smoothing
.. _exponential_smoothing/0:

.. rst-class:: right

**object**

``exponential_smoothing``
=========================

Simple, Holt linear-trend, and additive or multiplicative Holt-Winters exponential smoothing forecaster.

| **Availability:** 
|    ``logtalk_load(exponential_smoothing(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-10-24

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`forecaster_common <forecaster_common/0>`
|    ``public`` :ref:`exponential_smoothing_common <exponential_smoothing_common/0>`
| **Uses:**
|    :ref:`differential_evolution(Problem) <differential_evolution/1>`
|    :ref:`fast_random(Algorithm) <fast_random/1>`
|    :ref:`format <format/0>`
|    :ref:`integer <integer/0>`
|    :ref:`list <list/0>`
|    :ref:`nelder_mead(Problem) <nelder_mead/1>`
|    :ref:`numberlist <numberlist/0>`
|    :ref:`type <type/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`forecaster_protocol/0::check_forecaster/1`  :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`forecaster_protocol/0::diagnostic/2`  :ref:`forecaster_protocol/0::diagnostics/2`  :ref:`forecaster_protocol/0::export_to_clauses/4`  :ref:`forecaster_protocol/0::export_to_file/4`  :ref:`forecaster_protocol/0::forecast/3`  :ref:`forecaster_protocol/0::forecaster_options/2`  :ref:`forecaster_protocol/0::learn/2`  :ref:`forecaster_protocol/0::learn/3`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`forecaster_protocol/0::print_forecaster/1`  :ref:`forecaster_protocol/0::valid_forecaster/1`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: update/3
.. _exponential_smoothing/0::update/3:

``update/3``
^^^^^^^^^^^^

Returns a new forecaster after applying one numeric observation or, under skip_update, an unbound variable representing a missing observation. Does not bind missing observations.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``update(Forecaster,Observation,UpdatedForecaster)``
| **Mode and number of proofs:**
|    ``update(+compound,@term,-compound)`` - ``one_or_error``

| **Exceptions:**
|    ``Forecaster`` is a variable:
|        ``instantiation_error``
|    ``Forecaster`` is neither a variable nor a valid forecaster:
|        ``domain_error(forecaster,Forecaster)``
|    ``Observation`` is a variable under the error missing policy:
|        ``instantiation_error``
|    ``Observation`` is neither a variable nor a number:
|        ``type_error(number,Observation)``
|    ``Observation`` is a number but is not finite:
|        ``domain_error(finite_number,Observation)``
|    ``Observation`` is incompatible with the learned transformation:
|        ``domain_error(positive_transformation_series,Observation)``
|    ``Observation`` is incompatible with a multiplicative model:
|        ``domain_error(positive_multiplicative_series,Observation)``
|    The multiplicative level update is not positive:
|        ``domain_error(positive_multiplicative_level,Level)``
|    Update or diagnostic arithmetic fails:
|        ``evaluation_error(Error)``


------------

.. index:: forecast_interval/5
.. _exponential_smoothing/0::forecast_interval/5:

``forecast_interval/5``
^^^^^^^^^^^^^^^^^^^^^^^

Computes residual-bootstrap prediction interval bounds for the next ``Horizon`` forecasts of a learned forecaster. Requires a forecaster learned with the ``retain_residuals(true)`` learning option. For each of ``samples/1`` simulated paths and each horizon step, independently resamples, with replacement, one retained one-step training residual, adds it to the deterministic point forecast for that step (thus preserving the seasonal phase of the point forecast), and inverse-transforms the simulated value using the same transformation and bias adjustment as ``forecast/3``. The reported bounds are the empirical ``(1-confidence)/2`` and ``(1+confidence)/2`` quantiles of the simulated values for each step, widened when necessary so that the point forecast always lies within its bounds. A zero horizon returns two empty lists and does not require retained residuals.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``forecast_interval(Forecaster,Horizon,Lower,Upper,Options)``
| **Mode and number of proofs:**
|    ``forecast_interval(+compound,+non_negative_integer,-list(number),-list(number),+list(compound))`` - ``one_or_error``

| **Exceptions:**
|    ``Forecaster`` is a variable:
|        ``instantiation_error``
|    ``Forecaster`` is neither a variable nor a valid forecaster:
|        ``domain_error(forecaster,Forecaster)``
|    ``Horizon`` is a variable:
|        ``instantiation_error``
|    ``Horizon`` is neither a variable nor an integer:
|        ``type_error(integer,Horizon)``
|    ``Horizon`` is an integer but is negative:
|        ``domain_error(non_negative_integer,Horizon)``
|    ``Options`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Options`` is neither a variable nor a list:
|        ``type_error(list,Options)``
|    An option is a variable:
|        ``instantiation_error``
|    An option is neither a variable nor a compound term:
|        ``type_error(compound,Option)``
|    An option is a compound term but is not a valid interval option:
|        ``domain_error(option,Option)``
|    ``Horizon`` is positive and the forecaster was learned without ``retain_residuals(true)``:
|        ``domain_error(retained_residuals,Forecaster)``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

.. seealso::

   :ref:`forecaster_protocol <forecaster_protocol/0>`, :ref:`time_series_dataset_protocol <time_series_dataset_protocol/0>`

