2
$\begingroup$

I'm trying to classify a binary sample with Keras and I would like to classify as many correctly as possible, while ignore the ones where the model is not sure.

The fully connected Nerual network currencly achieves around 65% but I would like to get a higher result of correctly classified ones, while ignoring the ones where the model is uncertain.

Is there a way to tell Keras to simply ignore the ones where the model is uncertain and achieve a higher accuracy that way? Or is there a network design that could achieve this, for example feeding the result of the network striaght into a second part of it which then decides whether the prediction is likely accurate or not?

One way I was thinking of achieving this is by building a second neural network on top of it that decides based on the result of the first network and all the input data of it, whether the classification will be correct or not. Would that work, and if yes, is there no more elegant way of achieving this in one go, such as directly having the results feeding into a second part of the network that then decides if the prediction is likley accurate or not?

$\endgroup$
  • 1
    $\begingroup$ Look at the margin; the absolute value of the logit (input to the softmax). $\endgroup$ – Emre Nov 14 '17 at 18:24
2
$\begingroup$

Softmax output in neural networks can be misleading - often the confidence provided is higher than is intuitive. See e.g. here:

A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks https://pdfs.semanticscholar.org/c26e/1beaeaa55acae7336882de5df48716afb8bb.pdf

which suggests that in practice, softmax is not helpfully interpretable as a probability but should instead be used for ranking among class options.

If you want to have an accurate probability estimate, you might consider using a Bayesian approach in which you explicitly model your estimate of each of the input variances, the output variance, etc.

Failing that, having a second phase neural network that takes the input and predict correct or incorrect classification by the first network is an interesting idea - where incorrect classification is a proxy for 'low confidence' classification. If you try it I'd be curious to know how it works.

Edit: As @Emre said the input to the softmax would be more informative than the softmax itself because it's pre-scaled (i.e. not forced to sum to 1). So it should reflect confidence better, with values further away from 0 indicating higher confidence.

| improve this answer | |
$\endgroup$
  • $\begingroup$ So I just tried to put a second network on top of the first one to see if it can tell me which predictions of the 65% correct ones will be accurate. Interestingly it will predict that with exactly 65% accuracy as well. $\endgroup$ – Nickpick Nov 14 '17 at 20:56
  • $\begingroup$ I’m still looking for a way to maximise the accuracy in one go by having a third bucket with ‘unknown’. Ideally by implementing a custom loss function. Any ideas? $\endgroup$ – Nickpick Nov 22 '17 at 14:14
0
$\begingroup$

I got a similar task.

Maybe you can tune your trade-off by designing an appropriate cost function. Or, see F Score on wikipedia.

Reinforcement learning could also have tools you are looking for, namely, means of rewarding 'acting only if sure'. See e.g. the intro in Sutton, Barto

Or, try searching so called Conformal Prediction.

Venn Prediction is an extension of the original Conformal Prediction framework...

... for producing well-calibrated probabilistic predictions. It provides well-calibrated lower and upper bounds for the conditional probability of an example belonging to each possible class of the problem at hand. This paper proposes five VP methods based on Neural Networks

Keep us updated...

| improve this answer | |
$\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.