BinaryOneVSRest¶
- class torcheeg.transforms.BinaryOneVSRest(positive: int)[source][source]¶
Binarize the label following the fashion of the one-vs-rest strategy. When label is the specified positive category label, the label is set to 1, when the label is any other category label, the label is set to 0.
from torcheeg import transforms t = BinaryOneVSRest(positive=1) t(y=2)['y'] >>> 0
Binary
allows simultaneous binarization using the same threshold for multiple labels.from torcheeg import transforms t = transforms.BinaryOneVSRest(positive=1) t(y=[1, 2])['y'] >>> [1, 0]
- Parameters:
positive (int) – The specified positive category label.