# EEG parametric leadfield surrogate model¶

Starting from one of the previously generated parametric solutions, we can create a surrogate model to generate any new leadfield matrix for a set of electrical conductivities.

Warning

The computation of this surrogate model for a large leadfield matrix requires a large amount of memory. You should only perform this time consuming task if you are sure the output can fit in the RAM of your computer.

First, we load the parametric solution.

[ ]:

from shamo.eeg import SolParamEEGLeadfield



Next, as always, we load the class corresponding to the object we want to build. Here, it is the SurrEEGLeadfield class.

The surrogate model is built with the fit() function. To speedup the process, we can set the n_proc parameter.

[ ]:

from shamo.eeg import SurrEEGLeadfield


The resulting object can be used to generate a bunch of leadfield matrices with the predict() and predict_sol() methods.
[ ]:

import numpy as np