nemos.glm.PopulationGLM.predict#

PopulationGLM.predict(X)#

Predict rates based on fit parameters.

Parameters:

X (Union[Array, FeaturePytree]) – Predictors, array of shape (n_time_bins, n_features) or pytree of same.

Return type:

Array

Returns:

The predicted rates with shape (n_time_bins, ).

Raises:
  • NotFittedError – If fit has not been called first with this instance.

  • ValueError – If params is not a JAX pytree of size two.

  • ValueError – If weights and bias terms in params don’t have the expected dimensions.

  • ValueError – If X is not three-dimensional.

  • ValueError – If there’s an inconsistent number of features between spike basis coefficients and X.

Examples

>>> # example input
>>> import numpy as np
>>> X, y = np.random.normal(size=(10, 2)), np.random.poisson(size=10)
>>> # define and fit a GLM
>>> import nemos as nmo
>>> model = nmo.glm.GLM()
>>> model = model.fit(X, y)
>>> # predict new spike data
>>> Xnew = np.random.normal(size=(20, X.shape[1]))
>>> predicted_spikes = model.predict(Xnew)

See also

nemos.glm.GLM.score()

Score predicted rates against target spike counts.

nemos.glm.GLM.simulate()

Simulate neural activity in response to a feed-forward input (feed-forward only).

nemos.simulation.simulate_recurrent()

Simulate neural activity in response to a feed-forward input using the GLM as a recurrent network (feed-forward + coupling).