Precision Recall Tradeoff
Precision and Recall: Understanding the Trade-Off
by Samuel Hillis & Sara Hoormann
medium.com
Precision and Recall Tradeoff에 대한 재밌는 비유를 소개하고자 한다.
With classification algorithms, we have new metrics to ask about: precision and recall.
분류 알고리즘에서는 정확률과 재현율이라는 지표가 있다.
To explain precision and recall, let’s employ a fishing example.
정확률과 재현율을 설명하기 위해 다음의 예시를 보자.
Say there’s a pond that you like to fish in, and somehow you know the total number of fish that live there. Our goal is to build a model that catches red fish (we may say that we want to “predict” that we catch red fish).
당신이 물고기를 잡고 싶은 어떤 한 연못이 있는데 당신이 이 연못에 사는 물고기가 총 몇 마리 있는지 알고 있다고 하자. 우리의 목표는 빨간 물고기를 잡는 모델을 만드는 것이라고 하자. (다른 말로는 우리가 빨간 물고기를 잡는 것을 "예측"한다고 할 수 있다)
In our first test, we have a model that consists of two fishing poles, each with bait made from a scientific recipe with all the food that red fish like. The precision metric is about making sure your model works accurately (or, rather, that the predictions you make are accurate). With our fish example, that means that the fish caught with the special bait are, in fact, red.
첫번째 시도에서 우리는 두 개의 낚싯대가 있는데 여기엔 모든 빨간 물고기가 좋아하는 특별한 미끼가 걸려있다고 한다. 정확도라는 지표는 당신의 모델이 얼마나 정확한지 알려주는 지표이다. 정확도란 우리의 물고기 예시에서 특별한 미끼로 잡은 물고기가 빨간 물고기인 것을 말한다.
The following test shows great precision — the two fish caught were both red. We were trying to (or predicted we would) catch red fish, and all of the fish that we caught were red.
만약 두 개의 낚싯대로 두 마리의 빨간 물고기를 잡았다면 아주 높은 정확도를 보일 것이다. 우리는 빨간 물고기를 잡으려고 했고, 우리가 잡은 모든 물고기는 빨간 물고기였기 때문이다.

There is one small problem here though. We knew there were a lot more fish in the pond, and you might notice that when we looked closer we also found a lot more red fish that we didn’t catch. How can we do a better job of catching more of the red fish?
하지만 한 가지 작은 문제점이 있다. 우리는 연못에 훨씬 많은 물고기가 있다는 것을 알았고 당신은 더 자세히 봤다면 연못에 우리가 잡지 못한 빨간 물고기가 아주 많았음을 발견할 수 있었을 것이다! 우리는 어떻게 더 많은 빨간 물고기를 잡을 수 있을까?
Here is where our other measure, recall, comes into play. Recall increases as we catch more red fish. In our first model, we didn’t do a very good job of catching a high volume of red fish; although our precision was excellent, our recall was not so good.
그렇다면 재현율로 한 번 다시 물고기를 잡아보자. 재현율은 우리가 더 많은 빨간 물고기를 잡을수록 커진다. 우리의 첫번째 시도에서 우리는 많은 물고기를 잡지는 못했다. 그래서 정확도는 완벽했지만 우리의 재현율은 좋지 못했다.
Knowing this, we decide to develop a new model using a fishing net and a brand new bait recipe. The picture below shows the result of our first test with this new model. We caught more of the red fish! Our recall has definitely improved.
이것을 알고 나서 우리는 새로운 모델을 만드기로 했고, 어망과 다른 미끼를 이용해서 물고기를 잡기로 했다. 아래 그림은 새로운 모델로 잡은 결과를 보여준다. 우린 더 많은 물고기를 잡게 된 것이다! 우리의 재현율은 확실히 향상되었다.

Unfortunately, with this imprecise approach, we caught a lot of blue fish in our net as well. We weren’t trying to catch them, but they ended up in our net anyway. As our net got bigger and our bait became less specialized, our precision suffered as our recall improved.
불행히도, 이러한 방법은 정확하지 못하다. 우린 아주 많은 파란 물고기를 잡아버리게 되었다. 우린 파란 물고기를 잡으려고 하진 않았지만 어찌됐든 어망에 걸려들었다. 어망이 커지고 미끼가 덜 특수해진 결과 정확도는 떨어졌지만 재현율을 향상되었다.
This is the fundamental trade-off between precision and recall. Our model with high precision (most or all of the fish we caught were red) had low recall (we missed a lot of red fish). In our model with high recall (we caught most of the red fish), we had low precision (we also caught a lot of blue fish).
이것이 정확도와 재현율의 근본적인 트레이드 오프다. 높은 정확률을 보이는 모델(잡은 물고기 중 대부분 혹은 전부가 빨간 물고기)은 재현율이 낮았다. 높은 재현율을 보이는 모델(대부분의 물고기를 잡음)은 정확률이 낮았다(파란 물고기 또한 많이 잡음).
태생이 문과라서 그런지, 복잡한 수식보다는 이런 비유가 더 이해하기 쉽다.