pyriemann.transfer.TLSplitter

class pyriemann.transfer.TLSplitter(target_domain, cv)

Class for handling the cross-validation splits of multi-domain data.

This is a wrapper to sklearn’s cross-validation iterators [1] which ensures the handling of domain information with the data. In fact, the data from source domain is always fully available in the training partition whereas the random splits are done on the data from the target domain.

Parameters:
target_domainstr

Domain considered as target.

cvNone | BaseCrossValidator | BaseShuffleSplit, default=None

An instance of a cross-validation iterator from sklearn.

Notes

Added in version 0.4.

References

__init__(target_domain, cv)
get_n_splits(X=None, y=None)

Return the number of splitting iterations in the cross-validator.

Parameters:
Xobject

Ignored, exists for compatibility.

yobject

Ignored, exists for compatibility.

Returns:
n_splitsint

Number of splitting iterations in the cross-validator.

split(X, y)

Generate indices to split data into training and test set.

Parameters:
Xndarray, shape (n_matrices, n_channels, n_channels) or shape (n_vectors, n_ts)

Set of SPD matrices or tangent vectors.

yndarray, shape (n_matrices,) or shape (n_vectors,)

Extended labels for each matrix or vector.

Yields:
trainndarray

The training set indices for that split.

testndarray

The testing set indices for that split.

Examples using pyriemann.transfer.TLSplitter

Motor imagery classification by transfer learning

Motor imagery classification by transfer learning

Comparison of pipelines for transfer learning

Comparison of pipelines for transfer learning