2
$\begingroup$

I'm training a Neural Network to predict multiple labels for a given input. My input is a 200 sized vector of integers and the output should be a boolean vector of size 28. My y has a 1 on the corresponding classes the example corresponds to, i.e. the y should look like: [0, 0, 1, 0, ... 1, 0, 0].

Now, I've used a sigmoid function on my final layer, and I'm training with binary crossentropy since I want my model to treat each class as independent from each other.

When I fit my model, I get a pretty decent categorical accuracy, i.e. ~75%, but I'm wondering which is the threshold that Keras uses to say a class is or isn't present on the example, I mean, which is the threshold where it decides:

prediction[prediction >= threshold] = 1
prediction[prediction < threshold] = 0
$\endgroup$
2
$\begingroup$

You can look at your multi class classification as 28 separate binary classifiers (1 for each output feature).

The output of a binary classification is the probability of a sample belonging to a class, so the threshold per each feature is 0.5.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.