need to centralize each of the features. From each column, subtract the mean of that

icon
Related questions
Question

Solve the machine learning problem on Scaled Dot Product Attention using the given dataset (titanic dataset for ml).

1. You need to centralize each of the features. From each column, subtract the mean of that column. Then divide each column by the standard deviation of that column.

2.  There is no training in the attention mechanism.

3. In the testing section, take any test data a.

4. Let’s assume that we have n features.

5.  We have to figure out whether a survives or not.

6 and 7 are given in the picture

6. Let's say, we have m data points in the training dataset. For each i =
{1,2,, m), z, is the i'th feature vector and y, is the i'th label, our
output for test data a should be as follows (just another softmax):
sign { score(x₁, a)y;}
But how do we calculate the scores? It's as follows:
score(zi, a)
Σ
7. In this way, calculate the output for each a in the test set. Then finally
calculate the accuracy.
Transcribed Image Text:6. Let's say, we have m data points in the training dataset. For each i = {1,2,, m), z, is the i'th feature vector and y, is the i'th label, our output for test data a should be as follows (just another softmax): sign { score(x₁, a)y;} But how do we calculate the scores? It's as follows: score(zi, a) Σ 7. In this way, calculate the output for each a in the test set. Then finally calculate the accuracy.
Passengerld Survived
1
2
3
4
5
6700 C
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
0
1
1
1
0
0
0
0
1
1
1
1
0
0
0
1
0
1
0
1
0
1
1
1
0
1
0
0
1
0
0
1
1
0
0
0
1
0
Po
0
Pclass
Name
Sex
3 Braund, Mr. male.
1 Cumings, Mr female
3 Heikkinen, M female
1 Futrelle, Mrs female
3 Allen, Mr. W male
3 Moran, Mr. J male
1 McCarthy, M male
3 Palsson, Mas male
3 Johnson, Mrs female
2 Nasser, Mrs. female
3 Sandstrom, I female
1 Bonnell, Mis: female
3 Saundercock male
3 Andersson, N male
3 Vestrom, Mil female
2 Hewlett, Mrs female
3 Rice, Master male
2 Williams, Mimale
3 Vander Plank female
3 Masselmani, female
2 Fynney, Mr..male
2 Beesley, Mr. male
3 McGowan, N female
1 Sloper, Mr. V male
3 Palsson, Mis: female
3 Asplund, Mrs female
3 Emir, Mr. Fa male
1 Fortune, Mr. male
3 O'Dwyer, Mi: female
3 Todoroff, Mr male
1 Uruchurtu, D male
1 Spencer, Mrs female
3 Glynn, Miss. female
2 Wheadon, M male
1 Meyer, Mr. E male
1 Holverson, M male
3 Mamee, Mr. male
3 Cann, Mr. Eri male
3 Vander Plank female
Age
22
38
26
35
35
54
2
27
14
4
58
20
39
14
55
2
31
35
34
15
28
8
38
19
40
66
28
42
21
18
SibSp
1
1
0
1
0
0
0
3
0
1
1
0
0
1
0
0
4
0
1
0
0
0
0
0
3
1
0
3
0
0
0
1
0
0
1
1
0
0
2
Parch
Ticket
0 A/5 21171
0 PC 17599
O STON/02. 31
0
0
0
0
1
2
0
1 PP 9549
0
1
0
0
0
0
0
0
0
113803
373450
330877
17463
349909
347742
237736
0 A/5. 2151
5
0
0
1
5
0
2
0
113783
347082
350406
248706
382652
244373
345763
2649
239865
248698
330923
113788
349909
347077
2631
19950
330959
349216
0
0 PC 17601
0 PC 17569
0
0 C.A. 24579
0 PC 17604
0
335677
113789
2677
0
0 A./5. 2152
345764
Fare
7.25
71.2833 C85
7.925
53.1 C123
8.05
8.4583
51.8625 E46
21.075
11.1333
30.0708
16.7 G6
26.55 C103
8.05
31.275
7.8542
16
29.125
13
18
7.225
26
13 D56
8.0292
Cabin
35.5 A6
7.8792
7.8958
27.7208
146.5208 B78
7.75
10.5
82.1708
52
7.2292
8.05
18
Embarked
SUU
S
C
S
S
S
Q
S
S
S
C
USSSSS
S
S
S
S
21.075
S
31.3875
S
7.225
C
263 C23 C25 C27 S
Q
S
C
C
S
S
Q
S
S
с
S
S
Q
S
Q
S
C
S
C
S
s
Transcribed Image Text:Passengerld Survived 1 2 3 4 5 6700 C 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 0 1 0 Po 0 Pclass Name Sex 3 Braund, Mr. male. 1 Cumings, Mr female 3 Heikkinen, M female 1 Futrelle, Mrs female 3 Allen, Mr. W male 3 Moran, Mr. J male 1 McCarthy, M male 3 Palsson, Mas male 3 Johnson, Mrs female 2 Nasser, Mrs. female 3 Sandstrom, I female 1 Bonnell, Mis: female 3 Saundercock male 3 Andersson, N male 3 Vestrom, Mil female 2 Hewlett, Mrs female 3 Rice, Master male 2 Williams, Mimale 3 Vander Plank female 3 Masselmani, female 2 Fynney, Mr..male 2 Beesley, Mr. male 3 McGowan, N female 1 Sloper, Mr. V male 3 Palsson, Mis: female 3 Asplund, Mrs female 3 Emir, Mr. Fa male 1 Fortune, Mr. male 3 O'Dwyer, Mi: female 3 Todoroff, Mr male 1 Uruchurtu, D male 1 Spencer, Mrs female 3 Glynn, Miss. female 2 Wheadon, M male 1 Meyer, Mr. E male 1 Holverson, M male 3 Mamee, Mr. male 3 Cann, Mr. Eri male 3 Vander Plank female Age 22 38 26 35 35 54 2 27 14 4 58 20 39 14 55 2 31 35 34 15 28 8 38 19 40 66 28 42 21 18 SibSp 1 1 0 1 0 0 0 3 0 1 1 0 0 1 0 0 4 0 1 0 0 0 0 0 3 1 0 3 0 0 0 1 0 0 1 1 0 0 2 Parch Ticket 0 A/5 21171 0 PC 17599 O STON/02. 31 0 0 0 0 1 2 0 1 PP 9549 0 1 0 0 0 0 0 0 0 113803 373450 330877 17463 349909 347742 237736 0 A/5. 2151 5 0 0 1 5 0 2 0 113783 347082 350406 248706 382652 244373 345763 2649 239865 248698 330923 113788 349909 347077 2631 19950 330959 349216 0 0 PC 17601 0 PC 17569 0 0 C.A. 24579 0 PC 17604 0 335677 113789 2677 0 0 A./5. 2152 345764 Fare 7.25 71.2833 C85 7.925 53.1 C123 8.05 8.4583 51.8625 E46 21.075 11.1333 30.0708 16.7 G6 26.55 C103 8.05 31.275 7.8542 16 29.125 13 18 7.225 26 13 D56 8.0292 Cabin 35.5 A6 7.8792 7.8958 27.7208 146.5208 B78 7.75 10.5 82.1708 52 7.2292 8.05 18 Embarked SUU S C S S S Q S S S C USSSSS S S S S 21.075 S 31.3875 S 7.225 C 263 C23 C25 C27 S Q S C C S S Q S S с S S Q S Q S C S C S s
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer