ValueError: Classification metrics can't handle a mix of binary and continuous-multioutput targets

Hi!

I have some troubles to get sklearn’s cross_val_predict run for my ResNet18 (used for image classification). The scoring function is ‘accuracy’ and I get the error:
ValueError: Classification metrics can’t handle a mix of binary and continuous-multioutput targets.

My net returns the probabilities for each image to belong to one of my ten classes as float - I assume that the scoring is not working as the probabilites are floats… I also tried to use .round() but than I get the error: ValueError: Classification metrics can’t handle a mix of binary and multilabel-indicator targets, as often more than one class is set to one.

Can you help me to solve this problem? Thank you! :slight_smile:

“Accuracy” sounds like you would be expected to feed in the class number (the one with maximal probability) rather than a vector of probabilities.

Best regards

Thomas

I solved the problem by writing my own accuracy function which can handle continous-mulitoutput targets. It determines the maximum of the multioutput first.

Could you please explain me how you did that?
I think that I have the same problem but I am not able to fix it.

Really Thanks