Decoding

Decoding analyses are performed basically on a set of ROIs, contained in the dataset.

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.

Spatial decoding

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]

save(path=None, **kwargs)

[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

Temporal decoding

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.

fit(ds, time_attr='frame', roi='all', roi_values=None, cv_attr=None, prepro=<sekupy.preprocessing.base.Transformer object>, balancer=RandomUnderSampler(), return_splits=True, return_predictions=False, **kwargs)[source]

General method to fit data

Spatiotemporal regression

class sekupy.analysis.decoding.regression.RoiRegression(estimator=SVR(C=1, kernel='linear'), n_jobs=1, scoring=['r2'], permutation=0, verbose=1, name='roi_regression', **kwargs)[source]