calibrain.SourceEstimator#
- class calibrain.SourceEstimator(solver, solver_params=None, noise_var=None, n_orient=1, logger=None)[source]#
Methods
fit(L, y)Fit the inverse solver to the data.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
predict([y])score(X, y[, sample_weight])Return accuracy on provided data and labels.
set_fit_request(*[, L])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
set_score_request(*[, sample_weight])Configure whether metadata should be requested to be passed to the
scoremethod.- __init__(solver, solver_params=None, noise_var=None, n_orient=1, logger=None)[source]#
Initialize the SourceEstimator class.
- Parameters:
solver (callable) – The inverse solver function (e.g., gamma_map_sflex, BMN).
solver_params (dict, optional) – Parameters for the solver function.
noise_var (float, optional) – Noise variance for the solver.
logger (logging.Logger, optional) – Logger instance for logging messages.
n_orient (int, optional) – Number of orientations for the sources. Default is 1 (for fixed orientation) or 3 (for free orientation).
- fit(L, y)[source]#
Fit the inverse solver to the data.
- Parameters:
L (np.ndarray) – Leadfield matrix of shape (n_sensors, n_sources) for fixed orientation or (n_sensors, n_sources, n_orient) for free orientation.
y (np.ndarray) – Observed EEG/MEG signals of shape (n_sensors, n_times).
- Returns:
The fitted estimator.
- Return type:
self
- set_fit_request(*, L: bool | None | str = '$UNCHANGED$') SourceEstimator#
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') SourceEstimator#
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.