1
00:00:05,120 --> 00:00:07,740
Hi, welcome to this new video.

2
00:00:07,740 --> 00:00:09,280
In this video, we're

3
00:00:09,280 --> 00:00:11,180
going to start learning
about probability.

4
00:00:11,180 --> 00:00:12,460
This is going to be a very,

5
00:00:12,460 --> 00:00:14,360
very simple introduction
to probability.

6
00:00:14,360 --> 00:00:17,500
This is not again a
probability course,

7
00:00:17,500 --> 00:00:19,540
but within design,

8
00:00:19,540 --> 00:00:22,760
it's useful to have certain
understanding of how we could

9
00:00:22,760 --> 00:00:27,570
actually use probability
for determining variation.

10
00:00:27,570 --> 00:00:30,160
What do we mean by probability?

11
00:00:30,160 --> 00:00:32,960
Probability is a mathematical
concept that helps us

12
00:00:32,960 --> 00:00:37,200
quantify the likelihood
of certain events.

13
00:00:39,470 --> 00:00:41,760
When we start using the idea of

14
00:00:41,760 --> 00:00:44,340
a distribution or a
probability distribution,

15
00:00:44,340 --> 00:00:45,440
we start thinking of

16
00:00:45,440 --> 00:00:47,760
a statistical function
that describes

17
00:00:47,760 --> 00:00:50,160
all the possible values
and likelihoods of

18
00:00:50,160 --> 00:00:54,490
those values to happen
within a given range.

19
00:00:55,220 --> 00:00:58,740
What do we mean by all
the possible outcomes,

20
00:00:58,740 --> 00:00:59,960
i you start thinking of,

21
00:00:59,960 --> 00:01:02,520
let's say all the
possible circles,

22
00:01:02,520 --> 00:01:04,260
as you can see in the
drawing on the right,

23
00:01:04,260 --> 00:01:07,080
maybe we have a total number of

24
00:01:07,080 --> 00:01:10,720
nine circles and maybe

25
00:01:10,720 --> 00:01:13,480
the number of desired
outcomes is two.

26
00:01:13,480 --> 00:01:15,060
We can start thinking,

27
00:01:15,060 --> 00:01:16,880
what is the
probability of having

28
00:01:16,880 --> 00:01:22,135
two items maybe fitting
up certain criteria?

29
00:01:22,135 --> 00:01:24,685
Perhaps we would perform

30
00:01:24,685 --> 00:01:28,750
a different code
for those items.

31
00:01:28,910 --> 00:01:31,900
It's important to
know that we are

32
00:01:31,900 --> 00:01:34,020
evaluating in relation to

33
00:01:34,020 --> 00:01:37,130
the totality of the
possible outcomes.

34
00:01:37,470 --> 00:01:39,550
A simple way of thinking of

35
00:01:39,550 --> 00:01:42,045
probability is
through percentages,

36
00:01:42,045 --> 00:01:44,990
and we could start by
creating a random number.

37
00:01:44,990 --> 00:01:46,835
We know the function random,

38
00:01:46,835 --> 00:01:49,130
and if we start thinking
of a random value

39
00:01:49,130 --> 00:01:52,230
0-1 obviously considering
decimal places,

40
00:01:52,230 --> 00:01:54,150
we can quickly make

41
00:01:54,150 --> 00:01:56,435
a bit of math to
understand the percentage,

42
00:01:56,435 --> 00:01:58,610
if we would say
something that is less

43
00:01:58,610 --> 00:02:02,450
than 0.75 that
means that there's

44
00:02:02,450 --> 00:02:09,900
going to be a roughly 75%
chance of an event to occur.

45
00:02:10,190 --> 00:02:16,040
If we actually say bigger
than 0.75 in such condition,

46
00:02:16,040 --> 00:02:19,280
we would have a 25%
of that happening.

47
00:02:19,280 --> 00:02:20,860
This is not going
to be exact because

48
00:02:20,860 --> 00:02:22,340
when we're using a random value,

49
00:02:22,340 --> 00:02:26,685
the random value will be
different every time.

50
00:02:26,685 --> 00:02:30,390
You're not having
exactly the 75,

51
00:02:30,390 --> 00:02:34,530
25, there is going to be
a small variants there.

52
00:02:34,530 --> 00:02:37,090
But especially when we're
thinking of large populations,

53
00:02:37,090 --> 00:02:39,910
let's say we have hundreds
of elements in the screen,

54
00:02:39,910 --> 00:02:41,750
we can rely that we can

55
00:02:41,750 --> 00:02:43,650
operate with a sense
of probability.

56
00:02:43,650 --> 00:02:45,670
Let's say we want to color
some of those items,

57
00:02:45,670 --> 00:02:47,670
like 25% of those items,

58
00:02:47,670 --> 00:02:49,370
differently than the rest.

59
00:02:49,370 --> 00:02:51,050
This is where probability

60
00:02:51,050 --> 00:02:53,090
can actually play
out very nicely.

61
00:02:53,090 --> 00:02:56,030
Let's look at an example code.

62
00:02:56,030 --> 00:02:59,930
Here we go. We
have our template.

63
00:03:00,980 --> 00:03:04,815
Let's start by creating a
loop, like a four loop.

64
00:03:04,815 --> 00:03:08,225
Because I would like to work
with a range of elements.

65
00:03:08,225 --> 00:03:15,635
Four range, 0-100.

66
00:03:15,635 --> 00:03:20,980
A little bit of a
different language there.

67
00:03:21,290 --> 00:03:26,440
What we're going to do
is create an ellipse,

68
00:03:26,440 --> 00:03:29,580
a circle, basically in a
random location in the screen,

69
00:03:29,580 --> 00:03:31,095
so let's say x.

70
00:03:31,095 --> 00:03:35,820
If we want to use, let's
always remember to

71
00:03:35,820 --> 00:03:43,810
import the random
module up here.

72
00:03:43,810 --> 00:03:49,310
Let's do that uniform.

73
00:03:49,310 --> 00:03:54,750
Uniform here, because I want
all the decimal places.

74
00:03:55,340 --> 00:04:02,130
If I want to distribute
the ellipses,

75
00:04:02,130 --> 00:04:03,090
I'm going to draw ellipses

76
00:04:03,090 --> 00:04:04,930
basically everywhere
in the Canvas.

77
00:04:04,930 --> 00:04:06,630
I'm going to do a random value

78
00:04:06,630 --> 00:04:09,570
between zero and the
size of the screen.

79
00:04:09,980 --> 00:04:12,870
The x, it's going to be

80
00:04:12,870 --> 00:04:16,395
between zero and the
size of the screen.

81
00:04:16,395 --> 00:04:21,960
We can copy this line
for the y variable.

82
00:04:21,960 --> 00:04:24,585
We're going to create two
variables on x and y,

83
00:04:24,585 --> 00:04:28,270
and let's use the
height of the screen,

84
00:04:28,270 --> 00:04:31,190
in this case here.

85
00:04:31,390 --> 00:04:34,595
Now we can actually
draw our ellipse.

86
00:04:34,595 --> 00:04:38,390
Ellipse x, y,

87
00:04:38,390 --> 00:04:40,850
and the size, it doesn't matter.

88
00:04:40,850 --> 00:04:43,680
We can do 20, 20.

89
00:04:45,400 --> 00:04:49,890
At this point, we should have
100 ellipses in the screen.

90
00:04:49,890 --> 00:04:53,745
Let's just make sure
that we're going to do

91
00:04:53,745 --> 00:05:01,540
feel white at the moment
and maybe no stroke.

92
00:05:07,220 --> 00:05:09,825
Let's see if we're not
having any errors.

93
00:05:09,825 --> 00:05:13,770
We have 100 of those.
That's all good.

94
00:05:13,770 --> 00:05:16,350
Let's imagine that we want to

95
00:05:16,350 --> 00:05:20,385
use this notion of randomness
and probability to

96
00:05:20,385 --> 00:05:22,860
color red or change the color of

97
00:05:22,860 --> 00:05:27,300
the ellipses to 25% or 20%

98
00:05:27,300 --> 00:05:29,895
of them, a particular
percentage.

99
00:05:29,895 --> 00:05:31,785
The first thing
we're going to do

100
00:05:31,785 --> 00:05:33,705
is create a random value.

101
00:05:33,705 --> 00:05:38,230
Random number. This is
going to be a variable.

102
00:05:38,720 --> 00:05:47,680
We can here use random.uniform
between zero and one.

103
00:05:47,990 --> 00:05:51,700
If we print this value,

104
00:05:52,790 --> 00:05:56,760
let's just print it first
to see what we're getting.

105
00:05:56,760 --> 00:05:59,475
Every time you're using random,

106
00:05:59,475 --> 00:06:02,130
maybe you're not
so sure yet about

107
00:06:02,130 --> 00:06:05,415
the different versions of
random that are out there,

108
00:06:05,415 --> 00:06:08,740
you can certainly go and
read the documentation.

109
00:06:09,110 --> 00:06:13,845
But you see that we're

110
00:06:13,845 --> 00:06:18,910
getting a different
decimal place value.

111
00:06:19,850 --> 00:06:22,845
It's unlikely that
we're going to get one

112
00:06:22,845 --> 00:06:25,860
exactly or zero exactly,

113
00:06:25,860 --> 00:06:29,370
but because we have so
many decimal values.

114
00:06:29,370 --> 00:06:34,440
But we have a
distribution of values.

115
00:06:34,440 --> 00:06:38,565
Now we can comment out
this print statement.

116
00:06:38,565 --> 00:06:42,285
For each one of
those 100 ellipses,

117
00:06:42,285 --> 00:06:47,130
we have a random value
assigned to each one of them.

118
00:06:47,130 --> 00:06:50,140
Let's do an if statement.

119
00:06:52,610 --> 00:06:56,970
Remember that every time we're

120
00:06:56,970 --> 00:07:00,510
looping through one
version of the loop,

121
00:07:00,510 --> 00:07:01,890
we're creating a
new random value

122
00:07:01,890 --> 00:07:03,510
and we're going to be
evaluating it differently.

123
00:07:03,510 --> 00:07:09,705
So if this random value
is bigger than 0.2,

124
00:07:09,705 --> 00:07:16,620
so let's give 80% chance of
the first event to occur.

125
00:07:16,620 --> 00:07:20,050
We're going to add
here some code.

126
00:07:20,330 --> 00:07:28,500
Then let's say else and here
we can do some other code.

127
00:07:28,500 --> 00:07:30,765
What kind of code do we want?

128
00:07:30,765 --> 00:07:32,220
I think that for now

129
00:07:32,220 --> 00:07:33,660
I'm going to obviously
leave that door

130
00:07:33,660 --> 00:07:35,190
open for you to explore

131
00:07:35,190 --> 00:07:37,660
graphically something
more interesting.

132
00:07:38,450 --> 00:07:40,830
Just let's change the field.

133
00:07:40,830 --> 00:07:46,985
Let's say if it's bigger
than 0.2 meaning that

134
00:07:46,985 --> 00:07:48,950
80% of the ellipses
are going to be

135
00:07:48,950 --> 00:07:54,570
white and maybe 20% of
them are going to be red.

136
00:07:57,680 --> 00:08:01,065
Let's look at that.
As you can see,

137
00:08:01,065 --> 00:08:06,420
if you count, maybe sometimes
you'll see 21 or 19, or 18.

138
00:08:06,420 --> 00:08:14,490
The random doesn't really give
us an exact distribution,

139
00:08:14,490 --> 00:08:19,860
but roughly speaking,
we should be having 20%

140
00:08:19,860 --> 00:08:25,755
of our ellipsis being
in the second color.

141
00:08:25,755 --> 00:08:27,450
I think this is the beauty of

142
00:08:27,450 --> 00:08:28,590
working, especially in design,

143
00:08:28,590 --> 00:08:30,300
working with probability,
you're designing

144
00:08:30,300 --> 00:08:33,240
probabilistically. You're
not exactly saying

145
00:08:33,240 --> 00:08:37,455
where the red spheres are,

146
00:08:37,455 --> 00:08:39,420
or the total number of them.

147
00:08:39,420 --> 00:08:41,910
But you're roughly having
a composition between

148
00:08:41,910 --> 00:08:45,120
an 80% of white spheres
and a 20% of red ones.

149
00:08:45,120 --> 00:08:47,970
There's a lot of
interesting ideas that

150
00:08:47,970 --> 00:08:50,625
come from thinking,
probabilistically in design.

151
00:08:50,625 --> 00:08:52,830
If you want this distribution
to be more equal,

152
00:08:52,830 --> 00:08:55,410
like 50% like a 50/50,

153
00:08:55,410 --> 00:09:00,165
you can actually put a
0.5 here. There you go.

154
00:09:00,165 --> 00:09:04,545
You should have a
balance number.

155
00:09:04,545 --> 00:09:06,585
If you actually
bring this value up,

156
00:09:06,585 --> 00:09:10,530
right, somewhere to maybe 500,

157
00:09:10,530 --> 00:09:16,245
because we're generating a
random value every time,

158
00:09:16,245 --> 00:09:18,555
we are not depending
on this value.

159
00:09:18,555 --> 00:09:20,070
This number could be any number:

160
00:09:20,070 --> 00:09:22,350
it could be 1,000,
it could be 300.

161
00:09:22,350 --> 00:09:25,650
We're always going to get
a 50/50% distribution in

162
00:09:25,650 --> 00:09:27,030
this case because
we are actually

163
00:09:27,030 --> 00:09:28,770
evaluating a value
between zero and one,

164
00:09:28,770 --> 00:09:31,690
and we're cutting it halfway.

165
00:09:31,880 --> 00:09:34,380
We're going to be using
this technique quite a

166
00:09:34,380 --> 00:09:37,170
bit in the future,

167
00:09:37,170 --> 00:09:40,710
but again, this is the
introduction to this concept.

168
00:09:40,710 --> 00:09:43,590
Here we have again 20%
and again I invite you to

169
00:09:43,590 --> 00:09:48,670
play by increasing this
number to a much larger.

170
00:09:50,030 --> 00:09:52,650
Again, the point is not to count

171
00:09:52,650 --> 00:09:54,570
and see if this is
right or wrong.

172
00:09:54,570 --> 00:09:56,370
But it's roughly having a sense,

173
00:09:56,370 --> 00:09:58,590
am I getting a 20%?

174
00:09:58,590 --> 00:09:59,880
It might so happen
that you're actually

175
00:09:59,880 --> 00:10:01,620
having some spheres
on top of each other,

176
00:10:01,620 --> 00:10:05,310
so it might be very difficult
to evaluate precisely.

177
00:10:05,310 --> 00:10:07,350
You could create
a counter to see

178
00:10:07,350 --> 00:10:10,125
how many variable that counts.

179
00:10:10,125 --> 00:10:11,220
If this condition is true,

180
00:10:11,220 --> 00:10:12,570
I'm counting plus one.

181
00:10:12,570 --> 00:10:13,965
If second condition is true,

182
00:10:13,965 --> 00:10:15,810
you count plus one
in the other one,

183
00:10:15,810 --> 00:10:17,770
and you would see if in fact

184
00:10:17,770 --> 00:10:20,350
what is the final count
after you on the loop.

185
00:10:20,350 --> 00:10:22,295
But again, that could be

186
00:10:22,295 --> 00:10:24,530
a little bit of an
extra assignment

187
00:10:24,530 --> 00:10:26,170
that you can try on your own.

188
00:10:26,170 --> 00:10:27,540
We're going to leave this video

189
00:10:27,540 --> 00:10:28,760
here and I'll see
you in the next one.

190
00:10:28,760 --> 00:10:30,520
We're going to
continue looking at

191
00:10:30,520 --> 00:10:33,440
different functions for design.