What is the better way to predict classes for the models developed using the functional API in Keras
We can predict the class for new data instances using the Sequential classification model in Keras using the predict_classes() function. What is the way to predict the class for models that developed using the functional API?
For example, I have a model (functional API based) with sigmoid activation on the last layer to get probabilities in a multi-label classification. When I apply model.predict(), I got a series of probabilities even though the loss is binary_crossentropy.
I understand that I can do this classification manually e.g. following approach.
test_predict_proba = model.predict(x_test, batch_size=batch_size)
class_predict = (test_predicted_proba 0.5).astype(int)
I am wondering is there any standard procedure to do the same?
Topic predict functional-api keras multilabel-classification
Category Data Science