Skip to content

Conversation

@MarcoCerino23
Copy link
Contributor

Description

This PR addresses Issue #353 by adding the NeuromorphicCell, a reservoir cell inspired by biological excitation–inhibition balance.

Implementation Details

This contribution specifically implements Model 1 described in the issue, where the input is applied inside the nonlinearity:

$$ \mathbf{x}(t) = b_{\mathrm{ex}} \phi(W_{\mathrm{in}}\mathbf{u}(t) + a_{\mathrm{ex}}A\mathbf{x}(t-1)) - b_{\mathrm{inh}} \phi(W_{\mathrm{in}}\mathbf{u}(t) + a_{\mathrm{inh}}A\mathbf{x}(t-1)) $$

The implementation follows the standard AbstractReservoirRecurrentCell interface.

Parameters

The cell exposes the following hyperparameters (fixed during training):

  • a_ex, a_inh: Scaling factors for excitatory/inhibitory recurrence.
  • b_ex, b_inh: Scaling factors for the separated responses.
  • activation: The nonlinearity $\phi$ (defaults to tanh_fast).

Future Work

This PR focuses on establishing the cell structure and Model 1 dynamics. Model 2 (additive input) and the input gain parameter $g$ can be added in a follow-up PR.

Testing

  • Added test/layers/test_neuromorphiccell.jl.
  • Validated constructor, parameter shapes, Base.show, single-step forward, and batched forward passes.
  • Confirmed that the cell integrates correctly with the SciML reservoir construction pipeline.

- Adds src/layers/neuromorphic.jl with NeuromorphicCell struct and step function.
- Updates src/ReservoirComputing.jl to export/include the new cell.
- Adds structural tests in test/layers/test_neuromorphiccell.jl.
- Implements Model 1 dynamics as per Issue SciML#353.
@MartinuzziFrancesco
Copy link
Collaborator

This is looking good! Since there are two neuromorphic cells I'd suggest picking a more specific name. Keep in mind that we try to also provide the high level model, so take a look here on how to provide that as well.

Also don't forget to add both cell and model to the api docs

@MarcoCerino23
Copy link
Contributor Author

I have addressed all the feedback
Summary of changes:

  • Renamed NeuromorphicCell to EIESNCell (and updated the file structure).
  • Added the high-level EIESN model wrapper in src/models/eiesn.jl.
  • Updated Tests: Added comprehensive tests for both the cell (test/layers/test_eiesncell.jl) and the model (test/models/test_eiesn.jl).
  • Documentation: Added EIESNCell to layers.md and EIESN to models.md.

Let me know if everything looks good.

@MartinuzziFrancesco
Copy link
Collaborator

Nice, I think this is almost ready to be merged. The only things missing are addressing the unused typing in the cell, the citations, and maybe the naming of the kwargs. do you think we can use more expressive names? if not that's not an issue tbh

@MartinuzziFrancesco
Copy link
Collaborator

also, don't forget to format with Runic.jl. I still have to update the readme to indicate that we use that now

@MarcoCerino23
Copy link
Contributor Author

Done, I have formatted the files with Runic.jl.
I also addressed the other points:

  • Renamed parameters to be expressive (e.g., exc_recurrence_scale).
  • Cleaned up unused typing.
  • Added citations.

@MartinuzziFrancesco
Copy link
Collaborator

all right, I left a couple of minor comments. pending any test failures we can merge this

@MarcoCerino23
Copy link
Contributor Author

I couldn't find any specific new comments other than the renaming, typing, and formatting ones (which are addressed). If I missed something, could you please point it out? Also fixed a duplicate BibTeX entry.

@MartinuzziFrancesco
Copy link
Collaborator

MartinuzziFrancesco commented Jan 17, 2026

oh thanks! these lines are not needed and the T (= eltype(inp)) I would use here to make sure that the a_ex,a_inh, b_ex and b_inh are typed correctly

@MarcoCerino23
Copy link
Contributor Author

Thanks a lot for the clarification. I’ve removed the unused lines and now use T = eltype(inp) to cast the scaling coefficients for correct typing.

@MartinuzziFrancesco
Copy link
Collaborator

fantastic, as soon as tests pass we can merge this! I'll fix the spell check in another commit

@MartinuzziFrancesco MartinuzziFrancesco merged commit 6e386b6 into SciML:master Jan 18, 2026
16 of 18 checks passed
@MarcoCerino23 MarcoCerino23 deleted the neuromorphic-cell branch January 18, 2026 11:02
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