126 points · by paraschopra · 8y ago · 46 comments
If this was allowed then I'd make an ImageNet classifier which just discards all images except for one I'm really good at classifying, then claim I have 100% accuracy on ImageNet.
Edit: the entire point of bayesian approach is that you can make decisions on a loss function where you can make a tradeoff on the (business) cost of making a wrong decision and (business) regret of not making a decision. For real world applications, accuracy is a useless metric. What matters is the net (business) benefit or loss.
> My final classifier had accuracy of ~97% on MNIST and it refused to classify white noise and the majority of unrelated (non-MNIST) images.
I'm saying that you are making a misleading claim when you say this. It is categorically untrue that you achieve 97% on MNIST with this approach. Accuracy on a standardized test set makes no sense when you select a subset from the test set for maximal accuracy. I'm not saying that your approach doesn't have value or make sense in some business cases, because I think the overall idea is interesting but these statements are not correct.
Say p is the probability an image is of a cat.
p could be low, e.g. 0.05.
However, perhaps p has the 0.9 credible interval (0.01, 0.1). The width of that interval expresses how confident you are of the point estimate.
The correct translation of "I don't know" is a wide credible interval.
Parameters into a model can be modeled as random variables. Probabilities themselves cannot be, unless they are themselves parameters (or happen to coincide with a parameter) into another part of a statistical model. A statistical estimation of an event (in the sense of probability theory) must bottom out at a single number.
Let's take a coin toss as an example. It does not make sense to say I think that the coin has a 0.05 chance of flipping heads with a 0.9 credible interval of (0.01, 0.1). It does not make sense even to have a probability distribution on coming up heads (strictly speaking).
Coming up heads is an event and events do not distributions associated with them, but rather single probabilities.
On the other hand, we can model the outcomes of a coin with a Bernoulli distribution with parameter p where the probability of heads is p and that of tails is 1 - p. Notice here that p is a parameter that just happens to coincide with our probability. It then makes sense to talk of p as a random variable and having a distribution, credible interval, etc.
Note, however, that our estimation of the event of the coin coming up heads is still a single number at the end of the day. Our intermediate calculations might just involve integrating over the space of intermediate values of p, which means that p no longer coincides with the probability of heads (indeed it doesn't really make sense because p is no longer a single number).
But how do we express the intuition of "confidence in my probability estimate?" After all it seems like there's a difference between me saying this coin has a 50% chance of heads when I know it's fair and me saying a 50% chance of heads when you have me an unfamiliar coin I've never inspected (even though reasonable statistical models for either case might both say it's 50%).
In Bayesian statistics this is encoded entirely by the function that updates your posterior probability. If you are very "confident" your posterior probability will remain similar to your prior probability no matter what evidence you see (I know for sure this coin is fair so even if it comes up tails 1000 times I still think the next time will be 50% chance of heads). If you are not very confident your posterior probability might change more dramatically (hmm... I saw a string of tails, I'm pretty sure the next coin flip probably won't be heads again and I'll modify my probability accordingly).
x_i ~ Bernoulli(p) p ~ Beta(1,1)
For which the posterior IIRC:
p | x ~ Beta(n_tails+1, n_heads + 1)
Which, if you look up the variance of the Beta distribution, you will see a credible interval p shrink around the truth of p=0.5 if the coin is indeed fair.
This encapsulates the fact that if we have 5 heads and 5 tails we think the coin is fair. But if we have 500 heads and 500 tails we still think the coin is fair, but we're much more confident that it is so.
http://henripal.github.io/blog/langevin
And these papers-
1. https://arxiv.org/abs/1806.02855 2. http://arxiv.org/abs/1811.11145
Basically Softmax will only give you values close to 1 or close to 0, so there's no room for your own interpretation or threshold.
https://medium.com/@paraschopra/softmax-amplifies-small-diff...
Except this should not be surprising, because softmax is not scale invariant. Values on the unit scale is what you would normally expect, so if you feed it values 100x larger, it's going to be way more confident. If you feed it values 100x smaller, it's going to be way less confident.
There was another method proposed recently for approximating uncertainties: using dropout during evaluation (which effectively makes different runs on the same image as samples). But I came across a discussion on the efficacy of the technique and I wasn't sure. https://www.reddit.com/r/MachineLearning/comments/7bm4b2/d_w...
My next project is to implement dropout and see how it compares with the current approach. I'll also try your suggestion.
For that, you need actual Bayesian techniques.
Any idea how sampling compares in performance and computational efficiency?
Paper: http://arxiv.org/abs/1806.01768
Demonstration: https://muratsensoy.github.io/uncertainty.html
thres = wrong_cost / (wrong_cost+right_gain)
response = (max(out_probs) > thres) ? argmax(out_probs) : "I don't know"
While the bayesian methods can theoretically perform better for out-of-set inputs, it feels like an oversight to not include this simple method as a baseline. My gut feeling is that this would perform equally well, if not better.Softmax which is popular way to transform network outputs to probabilities pushes probabilities either to zero or one.
There may be other ways to transform outputs to probabilities where your approach could work but I'm not aware of them.
Also to reply to OP's comments, to have a class like 'I don't know' you need to have a dataset of things that don't look like your training dataset. And you'll always miss examples of things that don't belong to your input class. Bayesian solves it in a nice way by not requiring this infinite not-input training data.
Your comment reminded me of this xkcd comic https://xkcd.com/353/
Bayesian Approach: Pros and Cons
Pros
Can calculate explicit probabilities for hypotheses.Can be used for statistically-based learning.
Can in some cases outperform other learning methods.
Prior knowledge can be (incrementally) combined with newer knowledge to better approximate perfect knowledge.
Can make probabilistic predictions.
Cons
Require initial knowledge of many probabilities.Can become computationally intractable.
http://www.ru.is/faculty/thorisson/courses/v2008/gervigreind...
This is not a really big issue. You can always use uninformative priors, which is simply the Bayesian way of saying "I don't know" what the probability distribution looks like upfront. Then the data can help you infer the right shape of probabilities.
> Can become computationally intractable.
This is a bummer, but modern methods like variational inference and better sampling techniques are making Bayesian analysis on large-scale data and complex models tractable.
I linked a video the article that I highly recommend watching. Variational Bayes and Beyond: Bayesian Inference for Big Data https://www.youtube.com/watch?v=DYRK0-_K2UU
Can you make a two-stage design where the initial probabilities are generated by another machine learning model?
The gist is, you train a single classifier that will work as two classifiers (with certain restrictions): one that says "false/not-false" and another that says "true/not-true".
If the output of the classifier is "not-false" and "not-true", then you consider that as a "I don't know".
edit: does anyone know of any papers that talk about this technique formally?
By providing a good generative model, you are shifting the effort from collecting more data to carefully coding your expert knowledge. In my view, this is an exciting paradigm as it allows combination of human knowledge (as generating process and prjors) that can be overcome (in posterior distributions) if enough data is accumulated against it.