aeon icon indicating copy to clipboard operation
aeon copied to clipboard

[BUG] MLPClassifier predict_proba does not return probabilities

Open lngdet opened this issue 2 years ago • 7 comments

Describe the issue

After training an MLPClassifier model, the predict_proba method returns 0/1 values rather than probabilities. Shouldn't a multilayer perceptron be able to return predicted probabilities or am i missing something here? I've noticed this with several other time series classification algorithms in the aeon-toolkit. They all seem to come with a predict_proba method, but only a few actually yield true probabilities, most yield 0/1 values. Is there a way to list the classifiers that can return genuine probabilities? I checked all_tags but that's not one of the tags. For people who would like to compute AUCs, knowing which classifiers can predict probabilities would be very useful

Suggest a potential alternative/fix

No response

Additional context

No response

lngdet avatar Jun 01 '24 22:06 lngdet

hi, thanks for this. The default behaviour in the base class for classifiers is to return 0/1 probabilities unless the predict_proba is over-ridden in the sub class. It should be very easy to adapt deep learners to return probabilities, and it would be a good enhancement to do so. @hadifawaz1999 could we just over-ride predict_proba in BaseDeepClassifier to return the softmax probability estimates?

TonyBagnall avatar Jun 03 '24 19:06 TonyBagnall

and we could also have a tag to specify which do override predict_proba, that should be easy, good idea

TonyBagnall avatar Jun 03 '24 19:06 TonyBagnall

Thanks for raising the issue, could you please provide the code to reproduce this ? because by default all deep learners for classification return probabilities, its impossible to train them otherwise actually. So MLP should return probas not anything else when using predict_proba, and direct labels with predict

hadifawaz1999 avatar Jun 03 '24 20:06 hadifawaz1999

okay i found the bug, thanks for noticing this, the default activation parameter in MLPClassifier is set to sigmoid it should be softmax, will raise an issue for this

hadifawaz1999 avatar Jun 03 '24 20:06 hadifawaz1999

ah my mistake, I could actually look at the code before commenting, lol. Thanks for pointing this out @ingdet, once fixed I will raise an issue about probability predicting capability tag

TonyBagnall avatar Jun 03 '24 20:06 TonyBagnall

Should be solved in #1597

hadifawaz1999 avatar Jun 03 '24 20:06 hadifawaz1999

Thanks very much, @hadifawaz1999 and @TonyBagnall !

lngdet avatar Jun 04 '24 07:06 lngdet