Course: SBEG-108 Numerical Methods in Biomedical Engineering — Spring 2026, Cairo University
Instructor: Dr. Muhammad Rushdi
Problem: Chapter 4 — Dynamic Neuron Model, from Schiesser (2014)
Reference: Izhikevich, E. M. (2007). Dynamical Systems in Neuroscience: The Geometry of Excitability and Bursting. MIT Press.
Computational neuroscience relies on mathematical models to understand how neurons generate electrical signals. The Izhikevich (2007) biophysical neuron model combines the biological plausibility of Hodgkin–Huxley-type dynamics with the computational efficiency of integrate-and-fire models, reproducing the firing patterns of all known types of cortical neurons by tuning just four dimensionless parameters.
This project implements the Izhikevich model and solves it using:
- Three numerical methods: Runge–Kutta 4 (RK4), Backward Euler, and Adams–Bashforth 2 (AB2)
- One machine learning method: A Physics-Informed Neural Network (PINN)
All methods are benchmarked against a high-resolution ground truth trajectory produced by the Radau IIA implicit solver. The repository is structured so that each method shares a common configuration (config.py) and outputs trajectories in a standardized format for direct comparison.
| # | Member | Role | Deliverable |
|---|---|---|---|
| 1 | Ziyad Ashraf | Team Leader & Editor | Final IEEE paper, GitHub repository management |
| 2 | Adam Ghonaim | Literature Reviewer | Literature survey (2022–2026), theoretical background |
| 3 | Youssef Ahmed | Mathematical Modeler | config.py, mathematical formulation notes |
| 4 | Saif Mahmoud | Lead Data Engineer | Ground truth generation (ground_truth_generator.py) |
| 5 | Abdullah Hani | Explicit Solver Developer | RK4 solver (rk4.py) |
| 6 | Mahmoud Mazen | Implicit Solver Developer | Backward Euler solver (backward_euler.py) |
| 7 | Ahmed Abdulqader | Multi-Step Solver Developer | Adams–Bashforth 2 solver (adams_bashforth2.py) |
| 8 | Islam Refaey | ML Architect | PINN network design (architecture.py) |
| 9 | Hakeem Mohammed | ML Loss Function Designer | Physics loss & spike masking (physics_loss.py) |
| 10 | Seif Hegazy | ML Training Operator | Training loop & optimization (train.py) |
| 11 | Mohammed Hamdy | Master Evaluator & Analyst | Evaluation pipeline & visualizations (evaluator.py) |
The Izhikevich (2007) generalized biophysical model describes the membrane potential
with the discrete after-spike reset:
| Parameter | Value | Description |
|---|---|---|
| 100 pF | Membrane capacitance | |
| 0.7 nS/mV | Voltage scaling constant | |
| −60 mV | Resting membrane potential | |
| −40 mV | Instantaneous threshold potential | |
| 0.03 ms⁻¹ | Recovery time-scale | |
| −2.0 nS | Recovery sensitivity | |
| −50 mV | After-spike reset of |
|
| 100 pA | After-spike jump of |
|
| 35 mV | Spike cutoff voltage |
Simulation window:
The discrete reset is not part of the ODE — it is a conditional event applied after each integration step.
All numerical solvers are implemented in src/numerical/ and share the parameters from config.py. Outputs are NumPy arrays of shape (N, 3) with columns [Time (ms), v (mV), w (pA)].
The reference trajectory uses scipy.integrate.solve_ivp with the Radau IIA method (implicit Runge–Kutta, order 5). Tolerances are set to rtol = atol = 1e-12 with an evaluation grid of dt = 0.01 ms (100,001 output points). The Radau method is L-stable and specifically designed for stiff systems, ensuring reliable behavior during both the slow subthreshold dynamics and the fast spike upstroke.
The classic 4th-order Runge–Kutta method computes four intermediate slopes per step:
where
RK4 has global error O(
The implicit Euler method evaluates the derivative at the next time step:
Each step requires solving a 2×2 nonlinear system using scipy.optimize.fsolve. Backward Euler is unconditionally A-stable (the amplification factor
However, at large step sizes (
A second-order linear multi-step method using derivative history:
The discrete spike reset invalidates the AB2 history. A history flush protocol handles this: after each reset, a single Forward Euler step regenerates a valid history point before resuming AB2.
The PINN is implemented in src/ml_model/ and trained using pinn_training_colab.ipynb (Google Colab/Kaggle compatible).
A fully connected network maps time to physical state variables:
| Feature | Detail |
|---|---|
| Input | Time |
| Output |
|
| Hidden layers | 6 layers × 128 neurons, Tanh activation |
| Parameters | 83,074 |
| Weight init | Xavier normal |
| Output transform | Fixed affine denormalization to physical units |
The output denormalization ensures the network predicts the resting state (
| Term | Weight | Description | Points |
|---|---|---|---|
| 1.0 | ODE residual via torch.autograd.grad with spike masking |
100,000 (all) | |
| 200.0 | MSE vs sparse ground truth | 10,000 (10%) | |
| 200.0 | Initial condition penalty at |
1 |
ODE residual computation: Automatic differentiation (create_graph=True) computes
Spike masking: The discrete reset creates a discontinuity where the ODE residual becomes undefined. A curriculum schedule masks points near
| Phase | Optimizer | Epochs | Strategy |
|---|---|---|---|
| 1 | Adam (lr=1e-3) | 8,000 | Mini-batched physics + full-batch data; gradient clipping (max_norm=1.0) |
| 2 | L-BFGS (lr=0.1) | 100 | Fixed random subsample; strong_wolfe line search, history_size=50 |
Data strategy: The ground truth (100,001 points) is subsampled by a factor of 10, providing 10,001 sparse supervision points (10% of data). The remaining 90% of the time domain is covered exclusively by the physics loss, demonstrating the PINN's ability to leverage ODE knowledge for data-efficient learning.
| Method | Order | RMSE |
RMSE |
Spikes | Wall Time (s) |
|---|---|---|---|---|---|
| RK4 | O( |
1.59 | 1.89 | 6 | 4.52 |
| AB2 | O( |
1.60 | 1.91 | 6 | 5.51 |
| Backward Euler | O( |
2.02 | 2.41 | 6 | 29.71 |
All three solvers correctly detect 6 spikes at
| Step Size |
AB2 RMSE |
BE RMSE |
RK4 RMSE |
AB2 Spikes | BE Spikes | RK4 Spikes |
|---|---|---|---|---|---|---|
| 0.01 | 1.60 | 2.02 | 1.59 | 6 | 6 | 6 |
| 0.1 | 3.08 | 5.06 | 3.81 | 6 | 6 | 6 |
| 1.0 | 8.67 | 64.49† | 8.59 | 6 | 0 | 6 |
| 5.0 | 14.47 | 15.69 | 29.91 | 6 | 0 | 18 |
| 10.0 | 28.34 | 12.21 | NaN | 7 | 0 | — |
† Backward Euler detects 0 spikes at
The PINN successfully captures:
- ✅ Subthreshold dynamics — learned primarily from the physics loss with only 10% data supervision
- ✅ Spike timing and frequency — the ODE residual teaches the network when voltage should rise rapidly
- ✅ Recovery variable
$w(t)$ — accurately reproduced including post-spike jumps - ✅ Pre-stimulus quiescence — correct behavior during 0–100 ms silent period
Known limitation: Spike peak amplitudes are slightly underestimated after the first spike. The discrete reset (
| Reference | Year | Relevance |
|---|---|---|
| Schiesser, W. E. DE Analysis in Biomedical Science and Engineering. Wiley. | 2014 | Source problem (Chapter 4: Dynamic Neuron Model) |
| Izhikevich, E. M. Dynamical Systems in Neuroscience. MIT Press. | 2007 | Original model formulation |
| Raissi, M. et al. "Physics-informed neural networks." J. Comput. Phys., 378, 686–707. | 2019 | PINN framework |
| Cuomo, S. et al. "Scientific ML through PINNs: Where we are and what's next." J. Sci. Comput., 92(3), 88. | 2022 | PINN review and spike-masking strategies |
| Soltanipour, K. et al. "A comprehensive survey on the Izhikevich neuron model." Neural Networks, 154, 288–312. | 2022 | Izhikevich model survey and neuromorphic implementations |
| Sanyal, S. & Harris, J. G. "Adaptive and stiff numerical solvers for biological membrane dynamics." IEEE TBCAS, 17(3), 512–526. | 2023 | Numerical methods for stiff neuron models |
| Lu, L. et al. "PINNs and Neural ODEs for biological dynamical systems." Nature Reviews Methods Primers, 5(1), 12–34. | 2026 | PINNs applied to biological ODE systems |
- Time-windowed PINNs: Train separate networks on short time windows (~100 ms each) to handle the repeated spike discontinuities more effectively, stitching predictions at window boundaries.
- Hybrid architecture: Use the PINN for subthreshold dynamics and a discrete event handler for the spike reset, combining the strengths of both approaches.
-
Inverse PINN: Estimate model parameters (
$a, b, c, d$ ) directly from electrophysiological recordings by treating them as trainable parameters in the physics loss. - Extended benchmarks: Test all solvers on additional Izhikevich firing patterns (chattering, intrinsically bursting, fast spiking) to evaluate robustness across parameter regimes.
- Adaptive step-size methods: Replace fixed-$h$ integrators with embedded Runge–Kutta pairs (e.g., RK45) to efficiently handle the wide time-scale separation between subthreshold evolution and spike upstrokes.
Izhikevich-Dynamic-Neuron-Model/
├── config.py # Shared model parameters
├── main.py # Pipeline entry point
├── run_training.py # PINN training launcher
├── verify_pinn.py # PINN verification script
├── pinn_training_colab.ipynb # Colab/Kaggle training notebook
├── requirements.txt # Python dependencies
│
├── data/
│ └── ground_truth.csv # Radau reference trajectory
│
├── outputs/
│ ├── figures/ # Evaluation plots
│ └── models/ # Trained PINN weights (.pt)
│
└── src/
├── numerical/
│ ├── ground_truth_generator.py # Radau IIA ground truth
│ ├── rk4.py # Runge–Kutta 4
│ ├── backward_euler.py # Implicit Euler + fsolve
│ ├── adams_bashforth2.py # AB2 with history flush
│ └── README.md # Numerical methods documentation
├── ml_model/
│ ├── architecture.py # IzhikevichPINN network
│ ├── physics_loss.py # ODE residual + spike masking
│ ├── train.py # Two-phase training loop
│ └── README.md # PINN documentation
└── evaluation/
├── evaluator.py # Unified comparison pipeline
└── README.md # Evaluation documentation
python main.py --role 1python main.pypython run_training.pyUpload pinn_training_colab.ipynb and data/ground_truth.csv. Set the data path in Cell 1, then run all cells.
python verify_pinn.pynumpy
scipy
pandas
matplotlib
torch
Install: pip install -r requirements.txt
- Schiesser, W. E. (2014). Differential Equation Analysis in Biomedical Science and Engineering: ODE Applications with R. Wiley.
- Izhikevich, E. M. (2007). Dynamical Systems in Neuroscience: The Geometry of Excitability and Bursting. MIT Press.
- Raissi, M., Perdikaris, P., & Karniadakis, G. E. (2019). Physics-informed neural networks. J. Comput. Phys., 378, 686–707.
- Cuomo, S. et al. (2022). Scientific ML through PINNs. J. Sci. Comput., 92(3), 88.
- Soltanipour, K. et al. (2022). Izhikevich neuron model survey. Neural Networks, 154, 288–312.
- Ascher, U. M. & Petzold, L. R. (1998). Computer Methods for ODEs and DAEs. SIAM.