Skip to content Skip to sidebar Skip to footer

How To Predict Unseen Data From Trained Multi-label Text Classification Model?

First I want to say I am completely new to machine learning and still learning how these things work. I am working on categorizing reviews into multiple labels and built a multi-la

Solution 1:

If I understand it correctly. You train the model by setting the output of the model with OUTPUT_CLASSES = 2. Make it use sigmoid for the output layer by this condition.

if model_output_classes == 2:
    self.last_dense = layers.Dense(units=1,
                                   activation="sigmoid")
else:
    self.last_dense = layers.Dense(units=model_output_classes,
                                   activation="softmax")

It means you will get only one label with a probability range of 0 to 1. You can fix this by edit this variable to a number of your label to use softmax for the output layer instead. Softmax will give you a probability over labels.

Post a Comment for "How To Predict Unseen Data From Trained Multi-label Text Classification Model?"