plastic_balanced_network.network module

Plastic balanced network class. Includes functions to initialize, build connectivity, simulate, etc.

class plastic_balanced_network.network.PlasticNeuralNetwork(N, T, frac_exc=0.8, frac_ext=0.2, dt=0.1, jestim=0, jistim=0, nBinsRecord=10)[source]

Bases: object

PlasticNeuralNetwork is a class that builds a neural network with correlated or uncorrelated firing as well as with plastic or static synaptic weights on any connection. It contains functions to define the connectivity, simulate feedforward external spike trains, and to simulate the recurrent network’s firing.

Parameters:
  • N (int) – Total number of neurons.

  • T (int) – Total simulation time in milliseconds.

  • frac_exc (float) – Fraction of E neurons. Defaults to 0.8.

  • frac_exc – Fraction of E neurons in external layer. Defaults to 0.2.

  • dt (float or int) – Time bin size in milliseconds for time discretization. Defaults to 0.1 ms.

  • jestim (float or int) – Added constant current to excitatory neurons. Defaults to 0.

  • jistim (float or int) – Added constant current to inhibitory neurons. Defaults to 0.

  • nBinsRecord (int) – Number of bins to record average and record over. Defaults to 10.

Returns:

  • Ne (int) – Total number of E neurons (as part of self).

  • Ni (int) – Total number of I neurons (as part of self).

  • Nx (int) – Total number of X neurons (as part of self).

  • Nt (int) – Total number of discretized time points (as part of self).

  • Istim (np.ndarray) – Time vector of added constant stimulation (as part of self).

  • Jstim (np.ndarray) – Weight coupling for Istim (as part of self).

  • maxns (int) – Maximum number of spikes to terminate pathologic behavior (as part of self).

  • timeRecord (np.ndarray) – Discretized recorded time domain (as part of self).

  • Ntrec (int) – Number of points in discretized recorded time domain (as part of self).

connectivity(jee=25, jie=112.5, jei=-150, jii=-250, jex=180, jix=135, p_ee=0.1, p_ie=0.1, p_ei=0.1, p_ii=0.1, p_ex=0.1, p_ix=0.1, nJrecord0=100)[source]

Create connectivity matrix and arrays to record individual weights of all four connections.

Parameters:
  • jee (float) – Unscaled coupling strength from E to E neurons. Defaults to 25.

  • jie (float) – Unscaled coupling strength from E to I neurons. Defaults to 112.5.

  • jei (float) – Unscaled coupling strength from I to E neurons. Defaults to -150.

  • jii (float) – Unscaled coupling strength from I to I neurons. Defaults to -250.

  • jex (float) – Unscaled coupling strength from X to E neurons. Defaults to 180.

  • jix (float) – Unscaled coupling strength from X to I neurons. Defaults to 135.

  • p_ee (float) – Probability of connection from E to E neurons. Defaults to 0.1.

  • p_ie (float) – Probability of connection from E to I neurons. Defaults to 0.1.

  • p_ei (float) – Probability of connection from I to E neurons. Defaults to 0.1.

  • p_ii (float) – Probability of connection from I to I neurons. Defaults to 0.1.

  • p_ex (float) – Probability of connection from X to E neurons. Defaults to 0.1.

  • p_ix (float) – Probability of connection from X to I neurons. Defaults to 0.1.

  • nJrecord0 (int) – Count of synaptic weights recorded. Relevant when network is plastic. Defaults to 100.

Returns:

  • J (np.ndarray) – Recurrent connectivity matrix (as part of self).

  • Jx (np.ndarray) – External feedforward connectivity matrix (as part of self).

  • Jrecord_ee (np.ndarray) – Indices of recorded EE synaptic weights (as part of self).

  • Jrecord_ie (np.ndarray) – Indices of recorded IE synaptic weights (as part of self).

  • Jrecord_ei (np.ndarray) – Indices of recorded EI synaptic weights (as part of self).

  • Jrecord_ii (np.ndarray) – Indices of recorded II synaptic weights (as part of self).

  • numrecordJ_ee (int) – Number of recorded EE synaptic weights (as part of self).

  • numrecordJ_ie (int) – Number of recorded IE synaptic weights (as part of self).

  • numrecordJ_ei (int) – Number of recorded EI synaptic weights (as part of self).

  • numrecordJ_ii (int) – Number of recorded II synaptic weights (as part of self).

ffwd_spikes(T, cx=0.1, rx=0.01, taujitter=5)[source]

Create all spike trains of the Poisson feedforward, external layer.

Parameters:
  • T (int) – Total simulation time in milliseconds.

  • cx (float or int) – Value of mean correlation between feedforward Poisson spike trains. Defaults to 0.1.

  • rx (float or int) – Rate of feedforward Poisson neurons in kHz. Defaults to 0.01 kHz.

  • taujitter (float or int) – Spike trains are jittered by taujitter milliseconds to avoid perfect synchrony. Defaults to 5 ms.

Returns:

  • sx (np.ndarray) – Feedforward, Poisson spike trains recorded as spike time and neuron index (as part of self).

  • nspikeX (int) – Total number of spikes in sx (as part of self).

simulate(Cm=1, gL=0.06666666666666667, VT=-55, Vre=-75, Vth=-50, EL=-72, DeltaT=1, taue=8, taui=4, taux=10, tauSTDP=200, numrecord=100, eta_ee_hebb=0, jmax_ee=30, eta_ee_koh=0, beta=2, eta_ie_homeo=0, rho_ie=0.02, eta_ie_hebb=0, jmax_ie_hebb=125, eta_ei=0, rho_ei=0.01, eta_ii=0, rho_ii=0.02)[source]

Execute Network simulation.

Parameters:
  • Cm (float or int) – Membrane capacitance. Defaults to 1.

  • gL (float or int) – Leak conductance. Defaults to 1/15.

  • VT (float or int) – Threshold in EIF neuron. Defaults to -55.

  • Vre (float or int) – Reset voltage. Defaults to -75.

  • Vth (float or int) – Hard threshold that determines when a spike happened. Defaults to -50.

  • EL (float or int) – Resting potential. Defaults to -72.

  • DeltaT (float or int) – EIF neuron parameter. Determines the shape of the rise to spike. Defaults to 1.

  • taue (float or int) – Timescale of excitatory neurons in milliseconds. Defaults to 8 ms.

  • taui (float or int) – Timescale of inhibitory neurons in milliseconds. Defaults to 4 ms.

  • taux (float or int) – Timescale of external neurons in milliseconds. Defaults to 10 ms.

  • tauSTDP (float or int) – Timescale of eligibility trace used for STDP. Defaults to 200 ms.

  • numrecord (int) – Number of neurons to record currents and voltage from. Defaults to 100.

  • eta_ee_hebb (float or int) – Learning rate of EE Hebbian STDP. Defaults to 0. Pick a value in the approximate order of 10^-3 or lower as a start point.

  • Jmax_ee (float or int) – Hard constraint on EE Hebbian STDP. Defaults to 30/np.sqrt(N).

  • eta_ee_koh (float or int) – Learning rate of Kohonen STDP. Defaults to 0. Pick a value in the approximate order of 10^-3 or lower as a start point.

  • beta (float or int) – Parameter for Kohonen STDP. Defaults to 2/np.sqrt(N).

  • eta_ie_homeo (float or int) – Learning rate of iSTDP. Defaults to 0. Pick a value in the approximate order of 10^-3 or lower as a start point.

  • rho_ie (float or int) – Target rate of I neurons in iSTDP. Defaults to 0.020 kHz.

  • eta_ie_hebb (float or int) – Learning rate of IE Hebbian STDP. Defaults to 0. Pick a value in the approximate order of 10^-3 as a start point.

  • Jmax_ie_hebb (float or int) – Hard constraint on IE Hebbian STDP. Defaults to 125/np.sqrt(N).

  • eta_ei (float or int) – Learning rate of iSTDP. Defaults to 0. Pick a value in the approximate order of 10^-3 or lower as a start point.

  • rho_ei (float or int) – Parameter that determines target rate in iSTDP. Defaults to 0.010 kHz.

  • eta_ii (float or int) – Learning rate of iSTDP. Defaults to 0. Pick a value in the approximate order of 10^-3 or lower as a start point.

  • rho_ii (float or int) – Parameter that determines target rate in iSTDP. Defaults to 0.020 kHz.

Returns:

  • s (np.ndarray) – A tuple containing spike train of all neurons in recurrent neural network.

  • s (np.ndarray) – A tuple containing spike train of all feedforward neurons.

  • JRec_ee (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for EE recorded weights.

  • JRec_ie (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for IE recorded weights.

  • JRec_ei (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for EI recorded weights.

  • JRec_ii (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for II recorded weights.

  • IeRec (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for E recorded input currents.

  • IiRec (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for I recorded input currents.

  • IxRec (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for X recorded input currents.

  • VRec (np.ndarray) – Matrix of neurons (rows) by time bins (cols) for voltages of neurons in recurrent network.

  • timeRecord (np.ndarray) – Discretized recorded time domain.