الأسبوع 11 · الدرس ١ «التنبؤ باستخدام نموذج الذكاء الاصطناعي» (٢): النموذج الخطي ومعنى w وb والكود والتدريبات · 3 دروس
2
What w and b mean
ICT Prep 3 Term 1, Unit 2, Lesson 1: pp. 68–75
GoalFind b as the starting value and w as the change per step from a table, and calculate y.
New words
weight w · how much y changes for each step of x (the slope of the line)bias b · the value of y when x is 0 (the starting value)slope · another word for w: the steepness of the linestarting value · the value of y before any step is taken
Explanation
Two numbers describe a straight line. The bias b is the starting value: the value of y when x is 0. The weight w is the constant change: how much y changes when x grows by 1. Read them from the table of hours and marks: at x = 0 the mark is 40, so b = 40. From x = 0 to x = 1 the mark goes from 40 to 50, so w = 10 (50 minus 40). Some books call the constant step of 10 the bias, but that is wrong: the step is w, the starting value is b. Weights can be negative, too. With w = -2 and b = 20 the money left after x bus rides is y = -2x + 20, and the line goes down. With x = 5 rides: -2 × 5 + 20 = 10. The three models in the table are invented examples.
Situation
w
b
Meaning
marks from study hours
10
40
start 40, +10 per hour
a plant’s height in cm
4
25
start 25, +4 per day
money left after bus rides
-2
20
start 20, -2 per ride
Worked examples
A
B
C
D
E
1
x (hours)
0
1
2
3
2
y (marks)
40
50
60
70
3
change
+10
+10
+10
In the hours-and-marks sheet, b is the y-value under x = 0, which is 40, and w is the change from one column to the next, which is +10.
A
B
C
D
E
1
x (rides)
0
1
2
3
2
y (money left)
20
18
16
14
3
change
-2
-2
-2
The bus example has a negative weight. The change is -2 for every ride, so w = -2 and b = 20. After 5 rides: -2 × 5 + 20 = 10 is left.
Class activity
A plant is 25 cm tall at the start and grows 4 cm every day. Write w and b, write the model, and calculate the height after 5 days. Then invent a table where the weight is negative.
Practice
1
In the hours-and-marks table, what is b?
40, the value of y when x is 0.
2
In the table x = 0, 1, 2 and y = 10, 14, 18, what is w?