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_width
int Horizon time to forecast.
- n_neurons
int Number of neurons in the fully connected layers.
- drop_rate
float Rate of the dropout layer. This is used to estimate the epistemic error. Expected a value between 0 and 1. Default to 0.
- name
str The name of the layer. It defines also the block_type attribute.
- label_width
- Raises
ValueErrorIf name doesn’t contain Block. drop_rate is not between 0 and 1. All others arguments are not strictly positive integers.
- Attributes
label_widthintReturn the label_width.
input_widthintReturn the input_width.
input_specÌnputSpecInputSpec instance(s) describing the input format for this layer.
drop_ratefloatReturn the drop rate.
is_interpretableboolReturn True if the block is interpretable.
is_g_trainableboolReturn True if the last layer is trainable.
block_typestrReturn the block type.
- 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
NotImplementedErrorIf not overriden
- 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
NotImplementedErrorIf not overriden
ValueErrorRaise an error if the coefficients tensor shape is not equal to (d0, …, output_first_dim_forecast, label_width).