GeneralizedChainedScaleLayer class

A self-contained, chained, multi-scale recurrent layer.

This layer is designed to process a single, long sequence of high-frequency data (e.g., daily) by intelligently creating and processing lower-frequency summaries of the past.

It encapsulates three internal LSTM processors and two learnable aggregation mechanisms to achieve a hierarchical flow of information:

  1. Aggregation: The distant past is compressed into "weekly" and "monthly" summary vectors using learnable dense transformations.
  2. Processing: Three internal LSTMs process the monthly, weekly, and daily sequences in short, fixed-length loops.
  3. Chaining: The context (final hidden state) from the monthly LSTM is used to initialize the weekly LSTM, and the weekly LSTM's context initializes the daily LSTM, creating a deep, sequential chain for backpropagation. A generalized, chained, multi-scale recurrent layer.

This layer is a fully configurable version of the ChainedMultiScaleLayer. Instead of fixed "daily," "weekly," and "monthly" tiers, it accepts a list of graining sizes to dynamically build a hierarchy of any depth.

For example, a grainingSizes of [7, 4] creates a 3-tier system where:

  • Tier 2 (highest) summarizes chunks of 4 summaries from Tier 1.
  • Tier 1 summarizes chunks of 7 raw inputs from Tier 0.
  • Tier 0 (lowest) processes the most recent raw inputs.
Inheritance

Constructors

GeneralizedChainedScaleLayer({required int hiddenSize, required List<int> grainingSizes, int finalSequenceLength = 7})

Properties

aggB List<Tensor<Vector>>
getter/setter pair
aggW List<Tensor<Matrix>>
getter/setter pair
finalSequenceLength int
The number of recent, high-resolution steps for the final LSTM to process.
final
grainingSizes List<int>
Defines the aggregation factor at each level of the hierarchy. Example: 7, 4 means the first aggregation level groups 7 inputs, and the next level groups 4 of those summaries.
final
hashCode int
The hash code for this object.
no setterinherited
hiddenSize int
final
lstmBc List<Tensor<Vector>>
getter/setter pair
lstmBf List<Tensor<Vector>>
getter/setter pair
lstmBi List<Tensor<Vector>>
getter/setter pair
lstmBo List<Tensor<Vector>>
getter/setter pair
lstmWc List<Tensor<Matrix>>
getter/setter pair
lstmWf List<Tensor<Matrix>>
getter/setter pair
lstmWi List<Tensor<Matrix>>
getter/setter pair
lstmWo List<Tensor<Matrix>>
getter/setter pair
name String
A user-friendly name for the layer (e.g., 'dense', 'lstm').
getter/setter pairoverride-getter
numTiers int
final
parameters List<Tensor>
A list of all trainable tensors (weights and biases) in the layer.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(Tensor input) → void
Initializes the layer's parameters based on the shape of the first input.
override
call(Tensor input) Tensor
The public, callable interface for the layer.
inherited
concatenateAll(List<Tensor<Vector>> tensors) Tensor<Vector>
forward(Tensor input) Tensor<Vector>
The core logic of the layer's transformation.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited