GLM fitting utilities based on NeuroGLM by Il Memming Park, Jonathan Pillow:
Berk Gercek International Brain Lab, 2020
Parent class for multiple types of neural models.
NeuralModel(design_matrix, spk_times, spk_clu, binwidth=0.02, train=0.8, blocktrain=False, mintrials=100, stepwise=False)¶
Parent class for multiple types of neural models. Contains core methods for extracting trial-relevant spike times and binning spikes, as well as making sure that the design matrix being used makes sense.
Combined fit coefficients and intercepts to produce kernels where appropriate, which describe activity.
DataFrame in which each row is the fit weights for a given spiking unit. Columns are individual covariates added during the construction process. Indices are the cluster IDs for each of the cells that were fit (NOT a simple range(start, stop) index.)
- Return type
Fit the current set of binned spikes as a function of the current design matrix. Requires NeuralGLM.bin_spike_trains and NeuralGLM.compile_design_matrix to be run first. Will store the fit weights to an internal variable. To access these fit weights in a pandas DataFrame use the NeuralGLM.combine_weights method.
printcond (bool) – Whether or not to print the condition number of the design matrix. Defaults to True
coefs (list) – List of coefficients fit. Not recommended to use these for interpretation. Use the .combine_weights() method instead.
intercepts (list) – List of intercepts (bias terms) fit. Not recommended to use these for interpretation.
Bin function for a given timestep. Returns the number of bins after trial start a given t would occur at.
t (float) – Seconds after trial start
Number of bins corresponding to t using the binwidth of the model.
- Return type