You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/eval.jl
+68-20Lines changed: 68 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,8 @@ function eval_SC_loose end
25
25
"""
26
26
accuracy_comprehension(S, Shat, data)
27
27
28
-
Evaluate comprehension accuracy.
28
+
Evaluate comprehension accuracy for training data.
29
+
NOTE: in case of homophones/homographs in the dataset, the correct/incorrect values for base and inflections may be misleading! See below for more information.
@warn"This dataset contains homophones/homographs. Note that some of the results on the correctness of comprehended base/inflections may be misleading. See documentation of this function for more information."
87
+
end
88
+
81
89
if!isnothing(inflections)
82
90
all_features =vcat(base, inflections)
83
-
else
91
+
elseif!isnothing(base)
84
92
all_features = base
93
+
else
94
+
all_features = []
85
95
end
86
96
87
97
for f in all_features
@@ -110,7 +120,9 @@ end
110
120
inflections = nothing,
111
121
)
112
122
113
-
Evaluate comprehension accuracy.
123
+
Evaluate comprehension accuracy for validation data.
124
+
NOTE: in case of homophones/homographs in the dataset, the correct/incorrect values for base and inflections may be misleading! See below for more information.
125
+
114
126
115
127
# Obligatory Arguments
116
128
- `S_val::Matrix`: the (gold standard) S matrix of the validation data
@warn"This dataset contains homophones/homographs. Note that some of the results on the correctness of comprehended base/inflections may be misleading. See documentation of this function for more information."
189
+
end
190
+
163
191
corMat =cor(Shat_val, S, dims =2)
164
192
top_index = [i[2] for i inargmax(corMat, dims =2)]
165
193
@@ -435,7 +463,7 @@ function eval_SC(
435
463
436
464
# for first parts
437
465
for j =1:num_chucks-1
438
-
correct +=eval_SC_chucks(
466
+
correct +=eval_SC_chunks(
439
467
SChat_d,
440
468
SC_d,
441
469
(j -1) * batch_size +1,
@@ -445,7 +473,7 @@ function eval_SC(
445
473
verbose && ProgressMeter.next!(pb)
446
474
end
447
475
# for last part
448
-
correct +=eval_SC_chucks(
476
+
correct +=eval_SC_chunks(
449
477
SChat_d,
450
478
SC_d,
451
479
(num_chucks -1) * batch_size +1,
@@ -504,7 +532,7 @@ function eval_SC(
504
532
505
533
# for first parts
506
534
for j =1:num_chucks-1
507
-
correct +=eval_SC_chucks(
535
+
correct +=eval_SC_chunks(
508
536
SChat_d,
509
537
SC_d,
510
538
(j -1) * batch_size +1,
@@ -516,7 +544,7 @@ function eval_SC(
516
544
verbose && ProgressMeter.next!(pb)
517
545
end
518
546
# for last part
519
-
correct +=eval_SC_chucks(
547
+
correct +=eval_SC_chunks(
520
548
SChat_d,
521
549
SC_d,
522
550
(num_chucks -1) * batch_size +1,
@@ -529,13 +557,18 @@ function eval_SC(
529
557
round(correct / l, digits=digits)
530
558
end
531
559
532
-
functioneval_SC_chucks(SChat, SC, s, e, batch_size)
560
+
functioneval_SC_chunks(SChat, SC, s, e, batch_size)
533
561
rSC =cor(SChat[s:e, :], SC, dims =2)
534
562
v = [(rSC[i[1], i[1]+s-1] == rSC[i]) ?1:0for i inargmax(rSC, dims =2)]
535
563
sum(v)
536
564
end
537
565
538
-
functioneval_SC_chucks(SChat, SC, s, e, batch_size, data, target_col)
566
+
functioneval_SC_chucks(SChat, SC, s, e, batch_size)
567
+
@warn"eval_SC_chucks is deprecated and will be removed in version 0.10 in favour of eval_SC_chunks"
568
+
eval_SC_chunks(SChat, SC, s, e, batch_size)
569
+
end
570
+
571
+
functioneval_SC_chunks(SChat, SC, s, e, batch_size, data, target_col)
0 commit comments