Decoding¶
sekupy.analysis.decoding.cross_decoding module¶
- class sekupy.analysis.decoding.cross_decoding.CrossDecoding(estimator=None, n_jobs=1, scoring='accuracy', decoder=<class 'sekupy.analysis.decoding.roi_decoding.RoiDecoding'>, cv=LeaveOneGroupOut(), permutation=0, verbose=1, name='roi_decoding', **kwargs)[source]¶
Implement cross-decoding analyses using an arbitrary type of classifier.
- Parameters:
estimator ('svr', 'svc', or an estimator object implementing 'fit') – The object to use to fit the data
n_jobs (int, optional. Default is -1.) – The number of CPUs to use to do the computation. -1 means ‘all CPUs’.
scoring (string or callable, optional) – The scoring strategy to use. See the scikit-learn documentation If callable, takes as arguments the fitted estimator, the test data (X_test) and the test target (y_test) if y is not None.
permutation (int. Default is 0.) – The number of permutation to be performed. If the number is 0, no permutation is performed.
cv (cross-validation generator, optional) – A cross-validation generator. If None, a 3-fold cross validation is used or 3-fold stratified cross-validation when y is supplied.
verbose (int, optional) – Verbosity level. Defaut is False
- scores¶
The dictionary of results for each roi selected. The key is the union of the name of the roi and the value(s). The value is a list of values, the number is equal to the permutations.
- Type:
dict.
- fit(ds, training_conditions, testing_conditions, targets_map=None, cv_attr='chunks', roi='all', roi_values=None, prepro=<sekupy.preprocessing.base.Transformer object>, return_predictions=False, return_splits=True, return_decisions=False, **kwargs)[source]¶
[summary]
- Parameters:
ds ([type]) – [description]
training_condition (dictionary) – sub-dataset to be used in training phase, for example {‘subject’:[‘sub-1’, ‘sub-2’], ‘session’:[‘2’]} is used to train dataset on subjects 1 and 2 and session 2.
testing_conditions (dictionary) – sub-dataset to be used in testing phase, for example {‘subject’:[‘sub-3’, ‘sub-4’], ‘session’:[‘2’]} is used to test the decoder in subjects 1 and 2 and session 2.
targets_map (dictionary) – This is used for across-conditions decoding in which we want to translate conditions from, for example, Left-Cue/Right-Cue to Left-Hand/Right-Hand.
cv_attr (str, optional) – [description] (the default is ‘chunks’, which [default_description])
roi (list, optional) – list of strings that must be present in ds.fa keys (the default is ‘all’, which [default_description])
roi_values (list, optional) – A list of key, value tuple where the key is the roi name, specified in ds.fa.roi and value is the value of the subroi. (the default is None, which [default_description])
prepro ([type], optional) – [description] (the default is Transformer(), which [default_description])
return_predictions (bool, optional) – [description] (the default is False, which [default_description])
return_splits (bool, optional) – [description] (the default is True, which [default_description])
- Returns:
[description]
- Return type:
[type]
sekupy.analysis.decoding.regression module¶
sekupy.analysis.decoding.roi_decoding module¶
- class sekupy.analysis.decoding.roi_decoding.RoiDecoding(estimator=None, n_jobs=1, scoring='accuracy', cv=LeaveOneGroupOut(), permutation=0, verbose=1, name='roi_decoding', **kwargs)[source]¶
Implement decoding analysis using an arbitrary type of classifier.
- Parameters:
estimator ('svr', 'svc', or an estimator object implementing 'fit') – The object to use to fit the data
n_jobs (int, optional. Default is -1.) – The number of CPUs to use to do the computation. -1 means ‘all CPUs’.
scoring (string or callable, optional) – The scoring strategy to use. See the scikit-learn documentation If callable, takes as arguments the fitted estimator, the test data (X_test) and the test target (y_test) if y is not None.
permutation (int. Default is 0.) – The number of permutation to be performed. If the number is 0, no permutation is performed.
cv (cross-validation generator, optional) – A cross-validation generator. If None, a 3-fold cross validation is used or 3-fold stratified cross-validation when y is supplied.
verbose (int, optional) – Verbosity level. Defaut is False
- scores¶
The dictionary of results for each roi selected. The key is the union of the name of the roi and the value(s). The value is a list of values, the number is equal to the permutations.
- Type:
dict.
- fit(ds, cv_attr='chunks', roi='all', roi_values=None, prepro=<sekupy.preprocessing.base.Transformer object>, return_predictions=False, return_splits=True, return_decisions=False, **kwargs)[source]¶
[summary]
- Parameters:
ds ([type]) – [description]
cv_attr (str, optional) – [description] (the default is ‘chunks’, which [default_description])
roi (list, optional) – list of strings that must be present in ds.fa keys (the default is ‘all’, which [default_description])
roi_values (list, optional) – A list of key, value tuple where the key is the roi name, specified in ds.fa.roi and value is the value of the subroi. (the default is None, which [default_description])
prepro ([type], optional) – [description] (the default is Transformer(), which [default_description])
return_predictions (bool, optional) – [description] (the default is False, which [default_description])
return_splits (bool, optional) – [description] (the default is True, which [default_description])
- Returns:
[description]
- Return type:
[type]
sekupy.analysis.decoding.temporal_decoding module¶
- class sekupy.analysis.decoding.temporal_decoding.TemporalDecoding(estimator=None, n_jobs=1, scoring='accuracy', cv=LeaveOneGroupOut(), permutation=0, verbose=1, **kwargs)[source]¶
- Implement temporal generalization decoding analysis
using an arbitrary type of classifier.
see King 2014 TICS
- Parameters:
estimator ('svr', 'svc', or an estimator object implementing 'fit') – The object to use to fit the data
n_jobs (int, optional. Default is -1.) – The number of CPUs to use to do the computation. -1 means ‘all CPUs’.
scoring (string or callable, optional) – The scoring strategy to use. See the scikit-learn documentation If callable, takes as arguments the fitted estimator, the test data (X_test) and the test target (y_test) if y is not None.
permutation (int. Default is 0.) – The number of permutation to be performed. If the number is 0, no permutation is performed.
cv (cross-validation generator, optional) – A cross-validation generator. If None, a 3-fold cross validation is used or 3-fold stratified cross-validation when y is supplied.
verbose (int, optional) – Verbosity level. Defaut is False
- scores¶
The dictionary of results for each roi selected. The key is the union of the name of the roi and the value(s). The value is a list of values, the number is equal to the permutations.
- Type:
dict.
Module contents¶
- class sekupy.analysis.decoding.Decoding(estimator=None, n_jobs=1, scoring='accuracy', cv=LeaveOneGroupOut(), permutation=0, verbose=1, name='decoding', **kwargs)[source]¶
Implement decoding analysis using an arbitrary type of classifier.
- Parameters:
estimator ('svr', 'svc', or an estimator object implementing 'fit') – The object to use to fit the data
n_jobs (int, optional. Default is -1.) – The number of CPUs to use to do the computation. -1 means ‘all CPUs’.
scoring (string or callable, optional) – The scoring strategy to use. See the scikit-learn documentation If callable, takes as arguments the fitted estimator, the test data (X_test) and the test target (y_test) if y is not None.
permutation (int. Default is 0.) – The number of permutation to be performed. If the number is 0, no permutation is performed.
cv (cross-validation generator, optional) – A cross-validation generator. If None, a 3-fold cross validation is used or 3-fold stratified cross-validation when y is supplied.
verbose (int, optional) – Verbosity level. Defaut is False
- scores¶
The dictionary of results for each roi selected. The key is the union of the name of the roi and the value(s). The value is a list of values, the number is equal to the permutations.
- Type:
dict.
- fit(ds, cv_attr=None, return_predictions=False, return_splits=True, return_decisions=False, return_estimator=True, **kwargs)[source]¶
General method to fit data
- save(path=None, **kwargs)[source]¶
[summary]
- Parameters:
path ([type], optional) – [description] (the default is None, which [default_description])
- Returns:
[type] – [description]
<source_keywords>_target-<values>_task-<task>_mask-<mask>_
value-<roi_value>_date-<datetime>_num-<num>_<key>-<value>_data.mat