keras-team / autokeras

AutoML library for deep learning
http://autokeras.com/
Apache License 2.0
9.1k stars 1.4k forks source link

Bug: #1856

Open shabir1 opened 1 year ago

shabir1 commented 1 year ago

On binary classifier, AutoKeras returns only one class's probability on predict call.

        # model: is trained autokeras model
         prob = model.predict(vector)
         print(prob)

Data used by the code: Any binary classifier data

Expected Behavior.

It should return probabilities of all n classes. For binary, it should print as [0.18029907, 0.41025335] but it prints [0.18029907] For 3 classes it should print as [0.18029907, 0.41025335, 0.40944752] and it prints as expected [0.18029907, 0.41025335, 0.40944752]

prob = model.predict(vector)
prob = pd.DataFrame(prob)
print(prob.shape)

When I convert the above prob into a pandas data frame, For the binary class it prints one column only and for multiple class datasets it prints n columns where n is the number of classes. The issue is with binary classifiers only

Setup Details

Additional context

When I run it on multiple class datasets, then the predict call returns all class probability as expected