반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

Elements of AI - Odds and probability

2018. 6. 10. 03:53 | Posted by 솔웅


반응형


Elements of AI




I.Odds and probability



In the previous section, we discussed search and it’s application where there is perfect information – such as in games like chess. However, in the real world things are rarely so clear cut.

전 단원에서 우리는 search와 체스 같은 perfect information 게임 같은곳에 이 search를 적용하는 것에 대해 얘기 나눴습니다. 그런데 실제 세상에서는 이렇게 딱 뿌러지고 명확하게 설명할 수 없는 것들이 많이 있습니다.



Instead of perfect information, there is a host of unknown possibilities, ranging from missing information to deliberate deception.


perfect information 대신에 unknown possibilities 라는 것이 있습니다. missing information 에서 deliberate deception 까지 이러한 많은 unknown possibilities 경우는 많이 있습니다.




Take a self-driving car for example — you can set the goal to get from A to B in an efficient and safe manner that follows all laws. But what happens if the traffic gets worse than expected, maybe because of an accident ahead? Sudden bad weather? Random events like a ball bouncing in the street, or a piece of trash flying straight into the car’s camera?



자율 주행차를 예를 들어 보죠. A에서 B까지 모든 교통 법규를 다 지키면서 안전하고 효율적으로 가도록 세팅해 놓을 수 있겠죠. 그런데 예상했던 것 보다 교통 정체가 심할 경우에는 어떻게 해야 할까요? 아마 앞쪽에 사고가 나서 그런 일이 벌어질 수도 있겠죠. 갑자기 날씨가 안좋아 진다거나 길로 갑자기 공이 굴러온다거나 비닐봉지가 갑자기 자동차의 카메라를 가려버린다던가 하는 상황이 발생하면 어떻게 해야 할까요?




A self-driving car needs to use a variety of sensors, including sonar-like ones and cameras, to detect where it is and what is around it. These sensors are never perfect as the data from the sensors always includes some errors and inaccuracies called “noise”. It is very common then that one sensor indicates that the road ahead turns left, but another sensor indicates the opposite direction. This needs to be resolved without always stopping the car in case of even a slightest amount of noise.



자율주행차는 다양한 센서들을 사용해야 합니다. 음파 감지기나 카메라 같은 센서들이 있어서 지금 어디에 있는지 그리고 주변에는 어떤 것들이 있는지를 감지해야 합니다. 이런 센서들은 그 센서로부터 받아들인 데이터를 참조하도록 하는데 여기에는 일부 에러 혹은 “noise”라고 불리는 불분명한 정보 들도 포함되어 있습니다. 즉 완벽한 정보들은 아니라는 거죠. 하나의 센서가 앞쪽에 좌회전 구간이 있다는 것을 알려주는데 다른 센서는 그 반대쪽 즉 우회전 구간이 있다고 알려주기도 합니다. 이런 경우는 일반적으로 일어날 수 있는 현상입니다. 이런 조그만 노이즈가 있다고 일일이 차를 세워서 살펴보고 하지 않고도 해결할 수 있는 방법이 필요합니다.






Probability


One of the reasons why modern AI methods actually work in real-world problems - as opposed to most of the earlier “good old-fashioned" methods in the 1960-1980s - is their ability to deal with uncertainty.



현대 인공지능이 현실세계에서 실제로 이용될 수 있는 이유 중 하나는 이런 불확실성을 처리하는 능력이 있기 때문입니다. 1960~1980년대의 초기 인공지능을 다루던 옛날 방식에는 그러한 것들이 없었죠.



Note

The history of dealing with uncertainty


The history of AI has seen various competing paradigms for handling uncertain and imprecise information. For example, you may have heard of fuzzy logic. Fuzzy logic was for a while a contender for the best approach to handle uncertain and imprecise information and used in many customer-applications such as washing machines where the machine could detect the dirtiness (a matter of degrees, not only dirty or clean) and adjust the program accordingly.


인공 지능의 역사는 불확실하고 부정확 한 정보를 다룰 수 있는 다양한 패러다임들 간의 경쟁이었습니다. 예를 들어 여러분들은 퍼지 이론에 대해 들어봤을 수 있습니다. 퍼지 논리는 잠시 동안 불확실하고 부정확 한 정보를 처리하기위한 최선의 접근 방식이어였습니다. 이 기술은 실제 많은 가전제품에 사용됐었는데 더러움을 감지 (더럽고 깨끗함을 구분하는 정도가 아니라 얼마나 더러운가의 정도까지 감지)할 수 있는 기계로 세탁기 등을 만들었었습니다. 



However, probability has turned out to be the best approach for reasoning under uncertainty, and almost all current AI applications are based, in at least some degree, on probabilities.


probability 확률은 불확실성 하에서 추론을 위한 최선의 접근법이었으며  현재 거의 모든 AI 응용 프로그램이 적어도 어느 정도 확률에 기반합니다.





Why probability matters



We are perhaps most familiar with applications of probability in games: what are the chances of getting three of a kind in poker (about one in 46), what are the chances of winning in the lottery (very small), and so on. However, far more importantly, probability can also be used to quantify and compare risks in everyday life: what are the chances of crashing your car if you exceed the speed limit, what are the chances that the interest rates on your mortgage will go up by five percentage points within the next five years, or what are the chances that AI will automate particular tasks such as detecting fractured bones in X-ray images or waiting tables in a restaurant.



우리는 아마도 게임 할 때 이 확률을 활용하는 가장에 가장 익숙합니다. 포커에서 3 가지 종류의 무늬를 얻을 수 있는 확률 (약 1/46), 복권에 당첨 될 기회 (매우 작음) 등등 입니다. 또한 확률은 일상 생활의 위험을 계량하고 비교하는 것 같은 더 중요한 곳에서도 사용될 수 있습니다. 일상생활에서 양을 정하고 리스크를 비교하는 데서도 사용할 수 있겠죠. 과속을 하면 차가 충돌할 확률, 향후 5년안에 모기지가 5퍼센트 올라갈 확률, 혹은 인공지능이 엑스레이 사진을 보고 뼈가 부러진 것이라는 것을 알아차릴 수 있는 기회 상황, 식당에서 빈 테이블을 감지하는 기능을 가질 기회 상황 등등 




Note

The key lesson about probability


The most important lesson about probability that we’d like you to take away is not probability calculus. Instead, it is the ability to think of uncertainty as a thing that can be quantified at least in principle. This means that we can talk about uncertainty as if it were a number: numbers can be compared (“is this thing more probable than that thing”), and they can often be measured. The numbers in probability will sometimes be somewhat subjective, but we can nevertheless critically evaluate them, and our numbers can sometimes be found to be right or wrong. In other words, the lesson is that uncertainty is not something that is beyond the scope of rational thinking and discussion.


확률과 관련해 여러분들이 떨쳐 버렸으면 하는 부분은 확률은 어떤 계산법이라는 고정 관념입니다. 확률은 계산법이 아닙니다. 확률은 불확실성의 생각에 대한 능력입니다. 불확실성에 대해서 계량화 하는 겁니다. 이 의미는 우리는 불확실성에 대해 숫자화 해서 말 할 수 있다는 겁니다. 숫자는 비교될 수 있습니다. 그리고 숫자는 측량도 가능합니다. 확률에서의 숫자는 때때로 주관적일 수 있지만, 그럼에도 불구하고 우리는 비판적인 평가를 할 수 있습니다. 그리고 때때로 우리의 숫자에 대해 옳거나 그른 것으로 판명 할 수 있습니다. 즉, 불확실성은 합리적인 사고와 토론의 범위를 넘어서는 것이 아니라는 겁니다.




The fact that uncertainty can be quantified is of paramount importance, for example, in decision concerning vaccination or other public policies. Before entering the market, any vaccine is clinically tested, so that its benefits and risks have been quantified. The risks are never known to the minutest detail, but their magnitude is usually known to sufficient degree that it can be argued whether the benefits outweigh the risks.



불확실성을 정량화 할 수 있다는 사실은 예를 들어 백신 접종이나 기타 공공 정책과 관련한 결정에서 매우 중요합니다. 시장에 진입하기 전에 모든 백신은 임상 시험을 거쳐 그 이점과 위험이 정량화되었습니다. 위험 요소는 대개 아주 세세하게 알지는 못하지만 리스크 (위험요소)가 잇점과 비교해서 어느쪽을 선택할 것인지를 논의/결정할 수 있을 정도의 정보를 알 수는 있습니다. 




Note

Why quantifying uncertainty matters

If we think of uncertainty as something that can't be quantified or measured, the uncertainty aspect may become an obstacle for rational discussion. We may for example argue that since we don’t know exactly whether a vaccine may cause a harmful side-effect, it is too dangerous to use. However, this may lead us to ignore a life-threatening disease that the vaccine will eradicate. In most cases, the benefits and risks are known to sufficient precision to clearly see that one is more significant than the other.


불확실성을 계량화하거나 측정 할 수없는 것으로 생각하면 불확실성이 합리적 토론의 장애물이 될 수 있습니다. 예를 들어 우리는 백신이 유해한 부작용을 일으킬 수 있는지 여부를 정확하게 알지 못하기 때문에 사용하기에 너무 위험하다고 주장 할 수 있습니다. 그러나 이로 인해 우리는 백신이 근절 할 생명을 위협하는 질병을 무시할 수 있습니다. 대부분의 경우 이점과 위험은 하나가 다른 것보다 중요하다는 것을 분명히 알 수있을만큼 충분한 정확도로 알려져 있습니다.




The above lesson is useful in many everyday scenarios and professionally: for example, medical doctors, judges in a court of law, investors have to process uncertain information and make rational decisions based on them. Since this is an AI course, we will discuss how probability can be used to automate uncertain reasoning. The examples we will use include medical diagnosis (although it is usually not a task that we’d wish to automate), and identifying fraudulent email messages (“spam”).



위의 수업은 많은 일상적인 시나리오에서 전문적으로 유용합니다. 예를 들어 의료계의 의사, 법원의 판사, 투자자들은 불확실한 정보를 처리하고 이를 기반으로 합리적 결정을 내려야합니다. 지금은 AI 수업 과정 이므로 불확실성을 추론해 내는 과정을 자동화 하는 것에 대해 얘기를 할 것입니다.  우리가 사용하게 될 예에는 의료 진단 (자동 진단을하는 것이 보통은 아니지만)과 사기성 전자 메일 메시지 ( "스팸")를 식별하는 것이 포함됩니다.





Exercise 8: Probabilistic forecasts


Consider the following four probabilistic forecasts and outcomes. What can be conclude based on the outcome about the correctness of the forecasts? Can we conclude that the probability given by the forecast was indeed just right (choose "right"), that the forecast was wrong (choose "wrong"), or can conclude neither way (choose "cannot be concluded").


다음 네 가지 확률적 (기상) 예측과 결과를 생각해 보세요. 기상 예측의 정확성에 대한 도출물을 바탕으로 어떤 결론을 내릴 수 있습니까? 기상 예측에 의해 주어진 확률은 정말로 옳거나 ( "오른쪽"을 선택), 예측이 잘못되었거나 ( "틀린"을 선택), 어느쪽으로도 결론을 지을 수 없다고 결론을 내릴 수 있습니까 ( "결론을 내릴 수 없음"을 선택하십시오).



The weather forecast says it's going to rain with 90% probability tomorrow but the day turns out to be all sun and no rain.


We can't conclude that the weather forecast was wrong based on only the single event. The forecast said it's going to rain with 90% probability, which means it would not rain with 10% probability or in one out of 10 days. It is perfectly plausible that the day in question was the 1 in 10 event. Concluding that the probability 90% was correct would also be wrong because by the same argument, we could then conclude that 80% chance of rain was also correct, and both cannot be correct at the same time.



The weather forecast says it's going to rain with 0% probability tomorrow but the day turns out to be rainy.


The weather forecast was wrong because a 0% probability means that it should definitely not rain. But it did.



Suppose you monitor a weather forecaster for a long time. You only consider the days for which the forecast gives 70% chance of rain. You find that in the long run, on the average it rains on three out of every five days.


Strictly speaking, the weather forecasts are wrong if they predict 70% chance of rain and it rains only 60% (three out of five) of the time in the long run. In practice, weather forecasters actually tend to provide this kind of 'wrong' predictions just to be safe: people are often quite disappointed when the weather turns out to be worse than predicted but less disappointed when it turns out better than predicted.



In the United States presidential election 2016, a well-known political forecast blog, Five-Thirty-Eight, gave Clinton a 71.4% chance of winning (vs Trump's 28.6%). However, contrary to the prediction, Donald Trump was elected the 45th president of the United States.



Cannot be concluded to be wrong (or right). Sometimes unlikely things happen. Considering the previous item, it would actually have been wrong to predict, say, 90% or 100% chance for Trump if there simply isn't enough information available to anticipate the outcome. In other words, perhaps Trump's victory had a rare (or rareish) event with 23.1% probability. Such events are expected to happen almost in one out of four cases, after all.




Odds


Probably the easiest way to represent uncertainty is through odds. They make it particularly easy to update beliefs when more information becomes available (we will return to this in the next section).



아마도 불확실성을 나타내는 가장 쉬운 방법은 확률입니다. 더 많은 정보를 얻을 수 있을 때 beliefs을 높이는 것이 특히 쉽습니다 (다음 섹션에서이 부분으로 돌아갑니다).




Before we proceed any further, we should make sure you are comfortable with doing basic manipulations on ratios (or fractions). As you probably recall, fractions are numbers like 3/4 or 21/365. We will need to multiply and divide such things, so it's good to refresh these operations if you feel unsure about them. A compact presentation for those who just need a quick reminder is Wikibooks: Multiplying Fractions. Another fun animated presentation of the basic operations is Math is Fun: Using Rational Numbers. Feel free to consult your favourite source if necessary.



더 진행하기 전에 비율 (또는 분수)에 대한 기본 조작을 편안하게 수행해야합니다. 당신이 아마 기억 하듯이 분수는 3/4 또는 21/365와 같은 숫자입니다. 우리는 이러한 것들을 곱하고 나누어야 할 것입니다. 그래서 이 분수와 관련해 곱하기와 나누기를 하는 것을 잘 모르겠으면 이 부분을 다시 확인하시고 진행하시는 것이 좋습니다. 이를 다시 상기 할 수 있는 가장 빠른 방법은 Wikibooks: Multiplying Fractions를 보시는 겁니다. 이런 기본 과정을 보여주는 재밌는 만화처럼 만든 프리젠테이션은 Math is Fun : Rational Numbers 입니다. 여러분 한테 맞는 강의나 블로그를 찾아서 참조하셔도 됩니다.



By odds, we mean for example 3:1 (three to one), which means that we expect that for every three cases of an outcome, for example winning a bet, there is one case of the opposite outcome, not winning the bet. The other way to express the same would be to say that the chances of winning are 3/4 (three in four). These are called natural frequencies since they involve only whole numbers. With whole numbers, it is easy to imagine, for example, four people out of whom, three have brown eyes. Or four days out of which it rains on three (if you’re in Helsinki).



확률(odds)은 예를 들어 3 : 1 (3 대 1)을 의미합니다. 즉, 결과의 세 가지 사례 (예 : 베팅)에 대해 베팅에서 이기지 못하는 반대 결과가 한 번있는 경우를 의미합니다. 같은 것을 표현하는 다른 방법은 승리 확률이 3/4 (4분의 3)이라는 것입니다. 이것들은 정수만 포함하기 때문에 natural frequencies 라고합니다. 정수(whole numbers)를 가지고, 예를 들어, 4명 중에 3명은 갈색눈을 가진 사람이다 라던가 (헬싱키에 있다면) 4일 중 3일은 비가 내린다 같은 것을 표현하는 것은 쉽습니다






Note

Why we use odds and not percentages

Three out of four is of course the same as 75%. (Mathematicians prefer to use fractions like 0.75 instead of percentages.) It has been found that people get confused and make mistakes more easily when dealing with fractions and percentages than with natural frequencies or odds. This is why we use natural frequencies and odds whenever convenient.


4개중 3개란 말은 75 %와 동일한 말입니다. (수학자들은 백분율 대신 0.75와 같은 분수를 사용하는 것을 선호합니다.) 사람들은 natural frequencies 나 확률보다 분수와 퍼센트를 처리 할 때 혼란스럽고 실수를 쉽게하는 것으로 나타났습니다. 이것이 우리가 편리한 때마다 natural frequencies와 확률을 사용하는 이유입니다.



An important thing to notice is that while expressed as two numbers, 3 and 1 for example, the odds can actually be thought of as a single fraction or a ratio, for example 3/1 (three divided by one, which is clearly just 3). Thus the odds 3:1 is the same as the odds 6:2 or 30:10 since these are also equal to 3/1. Likewise, the odds 1:5 can be thought of as 1/5 = 0.2, which is the same as the odds 2:10 or 10:50. But be careful: the odds 1:5, even if it can be expressed as the number 0.2, is different from 20% probability (or probability 0.2 using the mathematicians' notation). For odds that are greater than one, such as 5:1, it is easy to remember that we are not dealing with probabilities because no probability can be greater than 1 (or greater than 100%), but for odds that are less than one such as 1:5, the danger of confusion lurks around the corner. The correspondence between odds and probabilities is further demonstrated in the following exercise.



알아 두어야 할 중요한 점은 두개의 숫자를 표현할 때 예를 들어 3과 1로 표현하는데 odds 확률에서는 한개의 분수나 비율로 나타나는 방식으로 예를 들어 3/1 이렇게 표현 됩니다. (3을 1로 나누기 즉 이 값은 3이 됩니다). 따라서 odds 확률 3 : 1은 확률이 6 : 2 또는 30:10과 같기 때문에 3 : 1이랑 똑같은 말입니다. . 마찬가지로, 확률 1 : 5는 1/5 = 0.2로 생각할 수 있습니다. 확률은 2:10 또는 10:50과 같습니다. 그러나 확률 1 : 5는 숫자 0.2로 표현 될 수 있습니다. 그런데 주의하실 점은 이것은 20 %의 probability 확률 (또는 수학자의 표기법을 사용한 확률 0.2)과는 다릅니다. 5 : 1과 같이 1보다 큰 odds 확률의 경우 우리는 이 probabilities 확률을 다루지 않습니다. 왜냐하면 어떤 probabilities 확률도 1 (100%) 보다 크지 않기 때문입니다. 1보다 작은 확률 예를 들어 odds 1 : 5 같은 경우는 약간 혼란스러울 수 있습니다. odds와 probabilities 사이의 상관 관계에 대해서는 다음 실습에서 잘 다루어 질 겁니다. 





Exercise 9: Odds

As we already mentioned above, the odds 3:1 – for example three rainy days for each rainless day – corresponds to probability 0.75 (or in percentages 75%).


위에서 다루었듯이 (odds 3:1) 3일동안 비가 오면 하루는 비가 안오는 날 은 probability 0.75로 표현할 수 있습니다. 퍼센테이지로는 75%이죠.



In general, if the odds in favor of an event are x:y, the probability of the event is given by x / (x+y).


일반적으로 odds가 x:y이면 probability는 x / (x+y) 입니다.



As we also pointed out, the odds 6:2 corresponds to exactly the same probability as the odds 3:1 because for x=6 and y=2, we also get the same result: x / (x+y) = 6/(6+2) = 6/8 = 3/4 = 0.75.


이미 얘기 했듯이 odds 6:2 는 odds 3:1과 probability가 같습니다. 왜냐면 x=6 and y=2 라도 계산하면 결과는 같기 때문입니다.  x / (x+y) = 6/(6+2) = 6/8 = 3/4 = 0.75.





반응형