[ ] we always has to invert valid_results for check_imp. I advice to take valid_labels instead as input.
[ ] we accept multidimensionnal check_imp to do a mean in the end. IMO, it should only take one-dimensional array and remove "mean"
[ ] clearly not enough pytested for the complexity of what it can do -> taking one-dimensional array will reduce complexity
def fuse_with_classif_result(check_imp, labels):
"""Adds at the good indexes the missing elements of labels because of the use of check_RMS
Parameters
----------
check_imp : list of list , shape (nb_epochs, nb_electrodes)
0s and 1s 0s marking bad channels for the designated epoch
labels : ndarray, shape (n_trials - nb_bad_epochs,)
array of the classification prediction results
Returns
-------
mod_labels : ndarray, shape (n_trials,)
Modified labels to fit a length of n_trials
"""
if not isinstance(labels, list):
labels = labels.tolist()
for i in range(len(check_imp)):
if np.mean(check_imp[i]) == 1:
labels.insert(i, False) # inserting False (neutral) values in the labels array where they were deleted
return labels
utils.fuse_with_classif_results
has many flaws :check_imp
. I advice to take valid_labels instead as input.check_imp
to do amean
in the end. IMO, it should only take one-dimensional array and remove "mean"