Simulation & Machine Learning

Interactive Hodgkin-Huxley Lab

The Basics

  • Action Potential: The electrical "spike" when a neuron fires.
  • Depolarisation: Voltage rises sharply. Think of this as the "gas pedal".
  • Hyperpolarisation: Voltage drops below rest. Think of this as the "brake".

The Chemistry

  • Sodium (Na+): Positive charge flowing in causes the spike (Depolarisation).
  • Potassium (K+): Positive charge flowing out resets the cell (Hyperpolarisation).
  • Resting memberane potential: -65 mV.
  • Hodgkin & Huxley (1952): A quantitative description of membrane current and its application to conduction and excitation in nerve.

Quick Presets

Stimulation

Current (I) 10.0 µA

Sodium (Na+)

Conductance 120 mS
Potential (E) 50 mV

Potassium (K+)

Conductance 36 mS
Potential (E) -77 mV

Get the Python source code here:

View Hodgkin Huxley Simulation Code on GitHub

McCulloch–Pitts Neuron (Binary threshold model)

What it is

  • Inputs: binary (0/1), like spikes present vs absent.
  • Weights: scale each input (excitatory if positive, inhibitory if negative).
  • Bias: a constant offset that shifts firing up/down.
  • Threshold (θ): fires if the weighted sum reaches it.
  • Output: binary (0/1), a simplified “fires / does not fire”.

Why you should care

  • This is the clean ancestor of the perceptron and modern neural nets.
  • It shows how logic gates (AND / OR / NOT / NAND) can be implemented with a single unit.
  • Important limitation: XOR cannot be done with a single unit; you need multiple layers.
  • McCulloch & Pitts (1943): A logical calculus of the ideas immanent in nervous activity.

Inputs

Weights + Threshold

w1 1.0
w2 1.0
bias 0.0
threshold (θ) 1.5

Logic presets

Output

y = 0
x1, x2 are inputs (0 = off, 1 = on).
w1, w2 are weights (positive excites, negative inhibits).
s = w1·x1 + w2·x2 + bias, and the neuron fires if s ≥ θ.

Action Potentials Simulation

Action Potentials Simulation GIF

Checkout the Action Potentials Simulation on GitHub:

View the GitHub Repository

E-Field Simulation

E-Field Simulation Image

Explore the Electric Field Simulation on GitHub:

View the GitHub Repository

Propofol and MEPs ML Model

Decision Tree Image

Explore the Machine Learning Algorithm to Predict Whether Handedness and Propofol Dosage have any effects on MEP amplitudes on GitHub:

View the GitHub Repository