[ENH] in TSC, add single labeled dataset warning
Is your feature request related to a problem? Please describe.
Classification tasks are generally supposed to have atleast 2 class labels.
Adding a check for this to all tensorflow and torch models in classification/deep_learning module is a good first enhancement.
Describe the solution you'd like
In classification/deep_learning module, raising a userwarning at _fit in tensorflow models and build_network in torch models is suggested.
self.num_classes = len(np.unique(y))
if self.num_classes == 1:
warnings.warn(
"The provided data passed to XXClassifierTorch contains " # replace XXClassifierTorch with class name
"a single label. If this is not intentional, please check.",
UserWarning,
)
Additional context
Originally posted by @RecreationalMath in https://github.com/sktime/sktime/pull/9298#discussion_r2779468790
@Faakhir30 This issue description is not descriptive enough. I'd suggest sticking to the Issue template.
@Faakhir30 are you working on this? If not, can I work on it?
@srupat Yes, I'm taking care of this soon. Issue description is not pointing to optimal solution.
This can be moved to base layer _base_torch.py with other base enhancements I'm working on.