Skip to content

Note

Click here to download the full example code

What's a GLM and why should you care?

GLM components

# first import things
import numpy as np
import workshop_utils
import pynapple as nap
import matplotlib.pyplot as plt

# configure plots some
plt.style.use(workshop_utils.STYLE_FILE)
weights = np.asarray([.5, 4, -4])
intercepts = np.asarray([.5, -3, -2])
# make a step function with some noise riding on top
input_feature = np.zeros(100)
input_feature[50:] = 1
input_feature *= np.random.rand(100)
input_feature =  nap.Tsd(np.linspace(0, 100, 100), input_feature)

fig = workshop_utils.plotting.lnp_schematic(input_feature,
                                            weights, intercepts)
fig = workshop_utils.plotting.lnp_schematic(input_feature,
                                   weights, intercepts,
                                   plot_nonlinear=True)
fig = workshop_utils.plotting.lnp_schematic(input_feature,
                                   weights, intercepts,
                                   plot_nonlinear=True, plot_spikes=True)

Total running time of the script: ( 0 minutes 0.000 seconds)

Download Python source code: 00_conceptual_intro_users.py

Download Jupyter notebook: 00_conceptual_intro_users.ipynb

Gallery generated by mkdocs-gallery