Search Light.
Fit, predict and score a series of models to each subset of the dataset along the last dimension. Each entry in the last dimension is referred to as a task.
The base estimator to iteratively fit on a subset of the dataset.
callable()
| str
| None
Score function (or loss function) with signature
score_func(y, y_pred, **kwargs)
.
Note that the “predict” method is automatically identified if scoring is
a string (e.g. scoring='roc_auc'
calls predict_proba
), but is
not automatically set if scoring
is a callable (e.g.
scoring=sklearn.metrics.roc_auc_score
).
int
| None
The number of jobs to run in parallel. If -1
, it is set
to the number of CPU cores. Requires the joblib
package.
None
(default) is a marker for ‘unset’ that will be interpreted
as n_jobs=1
(sequential execution) unless the call is performed under
a joblib.parallel_backend()
context manager that sets another
value for n_jobs
.
str
| int
| None
Control verbosity of the logging output. If None
, use the default
verbosity level. See the logging documentation and
mne.verbose()
for details. Should only be passed as a keyword
argument.
List of fitted scikit-learn estimators (one per task).
Methods
Estimate distances of each data slice to the hyperplanes. |
|
|
Fit a series of independent estimators to the dataset. |
|
Fit and transform a series of independent estimators to the dataset. |
|
Get parameters for this estimator. |
|
Predict each data slice/task with a series of independent estimators. |
Predict each data slice with a series of independent estimators. |
|
|
Score each estimator on each task. |
|
Set the parameters of this estimator. |
|
Transform each data slice/task with a series of independent estimators. |
Estimate distances of each data slice to the hyperplanes.
array
, shape (n_samples, nd_features, n_tasks)The input samples. For each data slice, the corresponding estimator
outputs the distance to the hyperplane, e.g.:
[estimators[ii].decision_function(X[..., ii]) for ii in range(n_estimators)]
.
The feature dimension can be multidimensional e.g.
X.shape = (n_samples, n_features_1, n_features_2, n_estimators).
array
, shape (n_samples, n_estimators, n_classes * (n_classes-1) // 2)Predicted distances for each estimator/data slice.
Notes
This requires base_estimator to have a decision_function
method.
Fit a series of independent estimators to the dataset.
array
, shape (n_samples, nd_features, n_tasks)The training input samples. For each data slice, a clone estimator is fitted independently. The feature dimension can be multidimensional e.g. X.shape = (n_samples, n_features_1, n_features_2, n_tasks).
array
, shape (n_samples,) | (n_samples, n_targets)The target values.
dict
of str
-> objectParameters to pass to the fit method of the estimator.
Return self.
Examples using fit
:
Decoding sensor space data with generalization across time and conditions
Fit and transform a series of independent estimators to the dataset.
array
, shape (n_samples, nd_features, n_tasks)The training input samples. For each task, a clone estimator is fitted independently. The feature dimension can be multidimensional, e.g.:
X.shape = (n_samples, n_features_1, n_features_2, n_estimators)
array
, shape (n_samples,) | (n_samples, n_targets)The target values.
dict
of str
-> objectParameters to pass to the fit method of the estimator.
array
, shape (n_samples, n_tasks) | (n_samples, n_tasks, n_targets)The predicted values for each estimator.
Predict each data slice/task with a series of independent estimators.
The number of tasks in X should match the number of tasks/estimators given at fit time.
array
, shape (n_samples, nd_features, n_tasks)The input samples. For each data slice, the corresponding estimator
makes the sample predictions, e.g.:
[estimators[ii].predict(X[..., ii]) for ii in range(n_estimators)]
.
The feature dimension can be multidimensional e.g.
X.shape = (n_samples, n_features_1, n_features_2, n_tasks).
array
, shape (n_samples, n_estimators) | (n_samples, n_tasks, n_targets)Predicted values for each estimator/data slice.
Predict each data slice with a series of independent estimators.
The number of tasks in X should match the number of tasks/estimators given at fit time.
array
, shape (n_samples, nd_features, n_tasks)The input samples. For each data slice, the corresponding estimator
makes the sample probabilistic predictions, e.g.:
[estimators[ii].predict_proba(X[..., ii]) for ii in range(n_estimators)]
.
The feature dimension can be multidimensional e.g.
X.shape = (n_samples, n_features_1, n_features_2, n_tasks).
array
, shape (n_samples, n_tasks, n_classes)Predicted probabilities for each estimator/data slice/task.
Score each estimator on each task.
The number of tasks in X should match the number of tasks/estimators
given at fit time, i.e. we need
X.shape[-1] == len(self.estimators_)
.
array
, shape (n_samples, nd_features, n_tasks)The input samples. For each data slice, the corresponding estimator
scores the prediction, e.g.:
[estimators[ii].score(X[..., ii], y) for ii in range(n_estimators)]
.
The feature dimension can be multidimensional e.g.
X.shape = (n_samples, n_features_1, n_features_2, n_tasks).
array
, shape (n_samples,) | (n_samples, n_targets)The target values.
array
, shape (n_samples, n_estimators)Score for each estimator/task.
Examples using score
:
Decoding sensor space data with generalization across time and conditions
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
dict
Parameters.
The object.
Transform each data slice/task with a series of independent estimators.
The number of tasks in X should match the number of tasks/estimators given at fit time.
array
, shape (n_samples, nd_features, n_tasks)The input samples. For each data slice/task, the corresponding
estimator makes a transformation of the data, e.g.
[estimators[ii].transform(X[..., ii]) for ii in range(n_estimators)]
.
The feature dimension can be multidimensional e.g.
X.shape = (n_samples, n_features_1, n_features_2, n_tasks).
array
, shape (n_samples, n_estimators)The transformed values generated by each estimator.
mne.decoding.SlidingEstimator
#Decoding sensor space data with generalization across time and conditions