autopycoin.models.create_interpretable_nbeats#

autopycoin.models.create_interpretable_nbeats(label_width: int, forecast_periods: Optional[Union[int, float, List[Union[int, float]]]] = None, backcast_periods: Optional[Union[int, float, List[Union[int, float]]]] = None, forecast_fourier_order: Optional[Union[int, float, List[Union[int, float]]]] = None, backcast_fourier_order: Optional[Union[int, float, List[Union[int, float]]]] = None, p_degree: int = 1, trend_n_neurons: int = 252, seasonality_n_neurons: int = 2048, drop_rate: float = 0.0, share: bool = True, name: str = 'interpretable_NBEATS', **kwargs: dict)[source]#

Wrapper which create an interpretable model as described in the original paper. Two stacks are created with 3 blocks each. The first entirely composed by trend blocks, The second entirely composed by seasonality blocks.

Within the same stack, it is possible to share the weights between blocks.

Parameters
label_widthint

Past to rebuild. Usually, label_width = n * input width with n between 1 and 7.

forecast_periodsTuple[int, …]

Compute the fourier serie period in the forecast equation. if a list is provided then all periods are taken.

backcast_periodsTuple[int, …]

Compute the fourier serie period in the backcast equation. if a list is provided then all periods are taken.

forecast_fourier_orderTuple[int, …]

Compute the fourier order. each order element refers to its respective period.

backcast_fourier_orderTuple[int, …]

Compute the fourier order. each order element refers to its respective back period.

p_degreeint

Degree of the polynomial function. It needs to be > 0.

trend_n_neuronsint

Number of neurons in th Fully connected trend layers.

seasonality_n_neurons: int

Number of neurons in Fully connected seasonality layers.

drop_ratefloat

Rate of the dropout layer. This is used to estimate the epistemic error. Expected a value between 0 and 1. Default to 0.

sharebool

If True, the weights are shared between blocks inside a stack. Dafault to True.

Returns
modelautopycoin.models.NBEATS

Return an interpetable model with two stacks. One composed by 3 TrendBlock objects and a second composed by 3 SeasonalityBlock objects.

Examples

>>> from autopycoin.models import create_interpretable_nbeats
>>> from autopycoin.losses import QuantileLossError
>>> model = create_interpretable_nbeats(label_width=3,
...                                     forecast_periods=[2],
...                                     backcast_periods=[3],
...                                     forecast_fourier_order=[2],
...                                     backcast_fourier_order=[3],
...                                     p_degree=1,
...                                     trend_n_neurons=16,
...                                     seasonality_n_neurons=16,
...                                     drop_rate=0.1,
...                                     share=True)
>>> model.compile(loss=QuantileLossError(quantiles=[0.5]))

Examples using autopycoin.models.create_interpretable_nbeats#