metabci.brainda.utils.performance module

class metabci.brainda.utils.performance.Performance(estimators_list=['Acc', 'pITR'], Tw=None, Ts=None, isdraw=False)[source]

Bases: BaseEstimator, TransformerMixin

Evaluation of BCI performance.

update log:

2023-12-10 by Leyi Jia <18020095036@163.com>, Add code annotation

Parameters:
  • Tw (float) – Signal duration (in second).

  • Ts (float) – Eye shift time (in second).

  • estimators_list (list) –

    supported estimators

    Acc: Accuracy classification score.

    bAcc: balanced accuracy to deal with imbalanced datasets.

    tITR: theoretical ITR.

    pITR: practical ITR.

    TPR: true positive rate(TPR).

    FNR: false negative rate(FNR).

    FPR: false positive rate (FPR).

    TNR: true negative rate (TNR).

    AUC: Area under the curve.

  • isdraw (bool) – Whether to draw the ROC curve.

estimators_list
supported estimators

Acc: Accuracy classification score.

bAcc: balanced accuracy to deal with imbalanced datasets.

tITR: theoretical ITR.

pITR: practical ITR.

TPR: true positive rate(TPR).

FNR: false negative rate(FNR).

FPR: false positive rate (FPR).

TNR: true negative rate (TNR).

AUC: Area under the curve.

Type:

list

Tw

Signal duration (in second).

Type:

float

Ts

Eye shift time (in second).

Type:

float

isdraw

Whether to draw the ROC curve.

Type:

bool

Tip

Example
1 1.from metabci.brainda.utils.performance import Performance.
2
3 2.performance = Performance(estimators_list=["Acc","pITR","TPR","AUC"], Tw=0.5, Ts=0.5).
4
5 3.results = performance.evaluate(y_true=y[test_ind], y_pred=p_labels, y_score=p_corr).
evaluate(y_true, y_pred, y_score=None)[source]

Transform EEG to covariance matrix.

update log:

2023-12-10 by Leyi Jia <18020095036@163.com>, Add code annotation

Parameters:
  • y_true (1d array-like) – Ground truth (correct) labels.

  • y_pred (1d array-like) – Predicted labels.

  • y_score (array-like of (n_samples, n_classes)) – Target scores.

Returns:

results – Evaluate the results and form a dictionary.

Return type:

list

metabci.brainda.utils.performance.profile(func)[source]