Skip to content

Conversation

@MarcoCerino23
Copy link
Contributor

Description

This PR implements the InputDelayESN model as requested in #314.

Key Changes:

  • New Model: Added InputDelayESN in src/models/esn_inputdelay.jl.
  • Architecture: The model is composed of a DelayLayer (acting as an input modifier), an ESNCell, and a LinearReadout.
  • Mathematical implementation:
    • Input expansion: $\mathbf{u}_{\mathrm{d}}(t) = [\mathbf{u}(t), \mathbf{u}(t-s), \dots, \mathbf{u}(t-Ds)]^T$
    • Reservoir update: $\mathbf{x}(t) = (1-\alpha) \mathbf{x}(t-1) + \alpha \phi(\mathbf{W}_{\text{in}}\mathbf{z}(t) + \mathbf{W}_r\mathbf{x}(t-1) + \mathbf{b})$
  • Testing: Added test/models/test_esn_inputdelay.jl to verify correct constructor wiring, parameter dimensions, and consistency with the AbstractEchoStateNetwork interface using outputsize.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the contributor guidelines, in particular the SciML Style Guide and COLPRAC.
  • Any new documentation only uses public API

Additional context

This PR addresses the first part of the requirements outlined in issue #314.

@MarcoCerino23
Copy link
Contributor Author

Thanks. I have finalized the InputDelayESN implementation following the feedback: internal DelayLayer for a batteries-included approach and exposed states_modifiers for flexibility. I've also merged the latest changes from the remote branch.

@MartinuzziFrancesco
Copy link
Collaborator

Nice, thanks! just a couple of minor naming things and we can merge this. Feel free to up the version too

@MarcoCerino23
Copy link
Contributor Author

Thanks Francesco! I'm already bumping the version to 0.12.14 in Project.toml.
Regarding the naming: could you please specify which names you'd like me to change? I couldn't find the inline comments in the 'Files changed' tab. Let me know and I'll update the code immediately.

num_delays::Int = 2, stride::Int = 1, readout_activation = identity,
states_modifiers = (), kwargs...
)
input_mods = _wrap_layers((DelayLayer(in_dims; num_delays = num_delays, stride = stride),))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove the _wrap_layers here, since we have just the DelayLayer

:readout,
),
}
input_modifiers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe change name to input_delay, we just pass the single layer here

@MartinuzziFrancesco
Copy link
Collaborator

my bad, I didn't submit the review earlier. can you see them now?

@MartinuzziFrancesco MartinuzziFrancesco merged commit 900d430 into SciML:master Jan 25, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants