nemos.glm.PopulationGLM.instantiate_solver#

PopulationGLM.instantiate_solver(*args, solver_kwargs=None)#

Instantiate the solver with the provided loss function.

Instantiate the solver with the provided loss function, and store callable functions that initialize the solver state, update the model parameters, and run the optimization as attributes.

This method creates a solver instance from nemos.solvers or the jaxopt library, tailored to the specific loss function and regularization approach defined by the Regularizer instance. It also handles the proximal operator if required for the optimization method. The returned functions are directly usable in optimization loops, simplifying the syntax by pre-setting common arguments like regularization strength and other hyperparameters.

Parameters:
  • *args – Positional arguments for the jaxopt solver.run method, e.g. the regularizing strength for proximal gradient methods.

  • solver_kwargs (Optional[dict]) – Optional dictionary with the solver kwargs. If nothing is provided, it defaults to self.solver_kwargs.

Return type:

BaseRegressor

Returns:

The instance itself for method chaining.