autopycoin.layers.BaseBlock#

class autopycoin.layers.BaseBlock(*args, **kwargs)[source]#

Base class of a nbeats block.

Your custom block needs to inherit from it.

Parameters
label_widthint

Horizon time to forecast.

n_neuronsint

Number of neurons in the fully connected 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.

namestr

The name of the layer. It defines also the block_type attribute.

Raises
ValueError

If name doesn’t contain Block. drop_rate is not between 0 and 1. All others arguments are not strictly positive integers.

Attributes
label_widthint

Return the label_width.

input_widthint

Return the input_width.

input_specÌnputSpec

InputSpec instance(s) describing the input format for this layer.

drop_ratefloat

Return the drop rate.

is_interpretablebool

Return True if the block is interpretable.

is_g_trainablebool

Return True if the last layer is trainable.

block_typestr

Return the block type.

property block_type: str#

Return the block type. Default to BaseBlock.

abstract coefficient_factory(*args: list, **kwargs: dict) tensorflow.python.framework.ops.Tensor[source]#

Create the coefficients used in the last layer a.k.a g constrained layer. This method needs to be overriden.

Raises
NotImplementedError

If not overriden

property drop_rate: float#

Return the drop rate.

abstract get_coefficients(output_last_dim: int, branch_name: str) tensorflow.python.framework.ops.Tensor[source]#

Return the coefficients used in the forecast and backcast layer a.k.a g layer by calling coefficient_factory. This method needs to be overriden.

Raises
NotImplementedError

If not overriden

ValueError

Raise an error if the coefficients tensor shape is not equal to (d0, …, output_first_dim_forecast, label_width).

property input_width: int#

Return the input_width.

property is_g_trainable: bool#

Return True if the last layer is trainable.

property is_interpretable: bool#

Return True if the block is interpretable.

property label_width: int#

Return the label_width.