Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Logistic Classifier: disable probability output type for multiclass predict #1414

Closed
TobyRoseman opened this issue Feb 13, 2019 · 4 comments · Fixed by #1472
Closed

Logistic Classifier: disable probability output type for multiclass predict #1414

TobyRoseman opened this issue Feb 13, 2019 · 4 comments · Fixed by #1472

Comments

@TobyRoseman
Copy link
Collaborator

import turicreate as tc

data = tc.SFrame([-100,-100,-100, 0,0,0, 100,100,100])
data['label'] = data['X1']
m = tc.logistic_classifier.create(data, 'label')

m.predict({'X1': 0}, output_type='probability')

The call to predict produces a long stack trace with the error message:
TypeError: Cannot convert [0.0773239 0.869718 0.0529583] to float

We shouldn't be trying to do a probability predict if the number of classes is more than two, per the docstring:

    - 'probability': Prediction probability associated with the True
      class (not applicable for multi-class classification)

We should just print a message about it being disabled for multi-class.

@srikris
Copy link
Contributor

srikris commented Feb 13, 2019

This feels like a regression. I'm pretty sure in 4.x, we provided that as an error message.

@hoytak
Copy link
Collaborator

hoytak commented Feb 19, 2019

It's a bug. It should work fine. Something is just assuming that the output of predict is a float, when in fact it can be an array (Like here).

@srikris
Copy link
Contributor

srikris commented Feb 19, 2019

@hoytak I think that would be probability_vector option which isn't the same as probability.

@hoytak
Copy link
Collaborator

hoytak commented Feb 21, 2019

@srikris Ah, yes, still a bug.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.