Probability & non-uniform distributions

Probability & non-uniform distributions

Remember when you first started programming here? Perhaps you wanted to draw a lot of circles on the screen. So you said to yourself: “Oh, I know. I’ll draw all these circles at random locations, with random sizes and random colors.” In a computer graphics system, it’s often easiest to seed a system with randomness. In these lessons, however, we’re looking to build systems modeled on what we see in nature. Defaulting to randomness is not a particularly thoughtful solution to a design problem—particularly the kind of problem that involves creating an organic or natural-looking simulation.

이 레슨에서는 자연에서 볼수 있는걸 형상화된 시스템을 만든는게 목표이기 때문에   무의미한 랜덤(?) 은 디자인 문제- 특히 유기적 또는 자연물 시뮬레이션에 관계되는 문제 에서는 – 에서 특별히 사려깊은 해결책이 아니다.

몇가지 트릭으로 우리는 random()로  "비정형" 랜덤숫자의 분배 를 생산하는 방법으로 바꿀수 있다. 

우리는 유적학 알고리즘을 시험할때 selection 해외를 위한 방법론이 필요할것이다.  우리인구의 어떤 멤머가 다음 세대 에 DNA를 넘겨주기위해 선택되어 지나…

최적의것이 생존한다(적자생존) 는 컨셉을 기억하나?  자여기서 원숭이인구의 진화에 대해 이야기 해보다. 모든 원숭이다 똑같은 재생산(번식)의 기회를 같지 못한다. 다윈의 진화론을 시뮬레이션을 하면 우리는 단순히 임의의 2마리 원숭이를  부모로 골라낼수 없다. 우리는 더 최적인것 (선택되어진)이 필요하다. 우리는  최적자의 확률을 정의할 필요가 있다.
예를 들어 가장 빠르고 강한 원숭이가 procreating할 90% 의 기회를 가질것디아. 약한원숭이는 10% 정도?

 

With a few tricks, we can change the way we use random() to produce “non-uniform” distributions of random numbers. This will come in handy throughout this course as we look at a number of different scenarios. When we examine genetic algorithms, for example, we’ll need a methodology for performing “selection”—which members of our population should be selected to pass their DNA to the next generation? Remember the concept of survival of the fittest? Let’s say we have a population of monkeys evolving. Not every monkey will have a equal chance of reproducing. To simulate Darwinian evolution, we can’t simply pick two random monkeys to be parents. We need the more “fit” ones to be more likely to be chosen. We need to define the “probability of the fittest.” For example, a particularly fast and strong monkey might have a 90% chance of procreating, while a weaker one has only a 10% chance.

잠깐 쉬고 확률의 기본원리를 보자. 첫째, 우리는 싱글 이벤트 확률을보자 어떤일이 일어날  가능성

Let’s pause here and take a look at probability’s basic principles. First we’ll examine single event probability, i.e. the likelihood that a given event will occur.

 

If you have a system with a certain number of possible outcomes, the probability of the occurrence of a given event equals the number of outcomes that qualify as that event divided by the total number of all possible outcomes. A coin toss is a simple example—it has only two possible outcomes, heads or tails. There is only one way to flip heads. The probability that the coin will turn up heads, therefore, is one divided by two: 1/2 or 50%.

Take a deck of fifty-two cards. The probability of drawing an ace from that deck is:

number of aces / number of cards = 4 / 52 = 0.077 = ~ 8%

The probability of drawing a diamond is:

number of diamonds / number of cards = 13 / 52 = 0.25 = 25%

We can also calculate the probability of multiple events occurring in sequence. To do this, we simply multiply the individual probabilities of each event.

The probability of a coin turning up heads three times in a row is:

(1/2) * (1/2) * (1/2) = 1/8 (or 0.125)

…meaning that a coin will turn up heads three times in a row one out of eight times (each “time” being three tosses).

Want to review probability before continuing? Study compound events and dependent probability.

There are a couple of ways in which we can use the random() function with probability in code. One technique is to fill an array with a selection of numbers—some of which are repeated—then choose random numbers from that array and generate events based on those choices.

 

오늘의 단어

survival of the fittest  적자 생존

You may also like...