Aidan Phillips commited on
Commit
c2756e2
·
1 Parent(s): 707614a

updated accuracy scaling function

Browse files
Files changed (2) hide show
  1. accuracy_scores.csv +99 -99
  2. categories/accuracy.py +9 -3
accuracy_scores.csv CHANGED
@@ -1,100 +1,100 @@
1
  German,English,Accuracy Score
2
- Ich bin müde.,I am tired.,99.99
3
- Das ist mein Buch.,That is my book.,100.0
4
- Er hat einen Hund.,He has a dog.,100.0
5
- Wir gehen nach Hause.,We are going home.,100.0
6
- Sie liest ein Buch.,She is reading a book.,99.97
7
- Ich liebe Schokolade.,I love chocolate.,100.0
8
- Hast du Geschwister?,Do you have siblings?,99.98
9
- Heute ist es kalt.,It is cold today.,100.0
10
- Wo ist der Bahnhof?,Where is the train station?,99.99
11
- Das Wetter ist schön.,The weather is nice.,100.0
12
- Er arbeitet im Büro.,He works in the office.,100.0
13
- Ich trinke Wasser.,I am drinking water.,100.0
14
- Sie tanzt gerne.,She likes dancing.,99.98
15
- Kannst du mir helfen?,Can you help me?,100.0
16
- Wir spielen Fußball.,We are playing soccer.,100.0
17
- Das Auto ist neu.,The car is new.,100.0
18
- Ich habe Hunger.,I am hungry.,100.0
19
- Guten Morgen!,Good morning!,100.0
20
- Er spricht Deutsch.,He speaks German.,100.0
21
- Ich mag Katzen.,I like cats.,100.0
22
- Sie kocht gern.,She likes cooking.,99.84
23
- Der Apfel ist rot.,The apple is red.,100.0
24
- Das Fenster ist offen.,The window is open.,100.0
25
- Ich wohne in Berlin.,I live in Berlin.,100.0
26
- Was machst du?,What are you doing?,100.0
27
- Er spielt Gitarre.,He plays guitar.,100.0
28
- Wir fahren morgen.,We are leaving tomorrow.,99.96
29
- Ich verstehe nicht.,I don't understand.,97.59
30
- Die Katze schläft.,The cat is sleeping.,100.0
31
- Sie ist meine Freundin.,She is my friend.,100.0
32
- Ich höre Musik.,I am listening to music.,99.98
33
- Das Haus ist groß.,The house is big.,100.0
34
- Er geht zur Schule.,He goes to school.,100.0
35
- Hast du Zeit?,Do you have time?,100.0
36
- Ich schreibe einen Brief.,I am writing a letter.,100.0
37
- Die Tür ist geschlossen.,The door is closed.,100.0
38
- Sie arbeitet viel.,She works a lot.,100.0
39
- Ich sehe einen Vogel.,I see a bird.,100.0
40
- Das Kind lacht.,The child is laughing.,100.0
41
- Wo wohnst du?,Where do you live?,100.0
42
- Ich lerne Deutsch.,I am learning German.,99.98
43
- Kann ich helfen?,Can I help?,100.0
44
- Das ist mein Bruder.,That is my brother.,100.0
45
- Sie hat lange Haare.,She has long hair.,100.0
46
- Wir sind müde.,We are tired.,100.0
47
- Der Hund bellt.,The dog is barking.,99.94
48
- Ich esse einen Apfel.,I am eating an apple.,100.0
49
- Wie heißt du?,What is your name?,99.99
50
- Mein Name ist Anna.,My name is Anna.,100.0
51
- Ich liebe dich.,I love you.,100.0
52
- Es ist sehr spät.,It is very late.,100.0
53
- Ich habe keine Zeit.,I have no time.,100.0
54
- Er liest die Zeitung.,He is reading the newspaper.,100.0
55
- Sie singt ein Lied.,She is singing a song.,100.0
56
- Ich sehe fern.,I am watching TV.,96.08
57
- Das ist einfach.,That is easy.,99.99
58
- Ich gehe einkaufen.,I am going shopping.,99.99
59
- Wo arbeitest du?,Where do you work?,100.0
60
- Ich arbeite im Krankenhaus.,I work at the hospital.,100.0
61
- Sie hat blaue Augen.,She has blue eyes.,100.0
62
- Wir essen zu Abend.,We are having dinner.,99.98
63
- Der Himmel ist blau.,The sky is blue.,100.0
64
- Was kostet das?,How much does that cost?,99.85
65
- Ich nehme das.,I'll take that.,78.48
66
- Ich bin krank.,I am sick.,99.99
67
- Es tut mir leid.,I'm sorry.,100.0
68
- Ich verstehe dich.,I understand you.,100.0
69
- Mach das Fenster zu.,Close the window.,99.96
70
- Wie spät ist es?,What time is it?,99.97
71
- Ich bin zu Hause.,I am at home.,100.0
72
- Gute Nacht!,Good night!,100.0
73
- Sie tanzen gern.,They like to dance.,99.98
74
- Ich gehe spazieren.,I am going for a walk.,99.98
75
- Der Kaffee ist heiß.,The coffee is hot.,100.0
76
- Woher kommst du?,Where are you from?,99.97
77
- Ich komme aus Deutschland.,I am from Germany.,100.0
78
- Sie hat ein schönes Lächeln.,She has a beautiful smile.,100.0
79
- Ich brauche Hilfe.,I need help.,100.0
80
- Das ist mein Vater.,That is my father.,100.0
81
- Sie ist meine Mutter.,She is my mother.,100.0
82
- Ich liebe meine Familie.,I love my family.,100.0
83
- Heute ist Montag.,Today is Monday.,100.0
84
- Ich bin glücklich.,I am happy.,100.0
85
- Er ist traurig.,He is sad.,99.99
86
- Wir lernen zusammen.,We are learning together.,99.99
87
- Das ist interessant.,That is interesting.,100.0
88
- Ich bin bereit.,I am ready.,100.0
89
- Er ist mein Lehrer.,He is my teacher.,100.0
90
- Der Ball ist rund.,The ball is round.,100.0
91
- Ich gehe zur Arbeit.,I am going to work.,99.98
92
- Sie trägt ein rotes Kleid.,She is wearing a red dress.,100.0
93
- Ich mag deinen Stil.,I like your style.,99.99
94
- Er lacht laut.,He is laughing loudly.,99.96
95
- Wir sehen uns morgen.,See you tomorrow.,100.0
96
- Ich wünsche dir viel Glück.,I wish you good luck.,100.0
97
- Bitte sei leise.,Please be quiet.,100.0
98
- Ich habe es vergessen.,I forgot it.,100.0
99
- Es ist nicht wichtig.,It is not important.,100.0
100
- Können wir reden?,Can we talk?,100.0
 
1
  German,English,Accuracy Score
2
+ Ich bin müde.,I am tired.,0.93
3
+ Das ist mein Buch.,That is my book.,0.97
4
+ Er hat einen Hund.,He has a dog.,0.97
5
+ Wir gehen nach Hause.,We are going home.,0.95
6
+ Sie liest ein Buch.,She is reading a book.,0.88
7
+ Ich liebe Schokolade.,I love chocolate.,0.97
8
+ Hast du Geschwister?,Do you have siblings?,0.89
9
+ Heute ist es kalt.,It is cold today.,0.96
10
+ Wo ist der Bahnhof?,Where is the train station?,0.93
11
+ Das Wetter ist schön.,The weather is nice.,0.95
12
+ Er arbeitet im Büro.,He works in the office.,0.97
13
+ Ich trinke Wasser.,I am drinking water.,0.94
14
+ Sie tanzt gerne.,She likes dancing.,0.9
15
+ Kannst du mir helfen?,Can you help me?,0.97
16
+ Wir spielen Fußball.,We are playing soccer.,0.94
17
+ Das Auto ist neu.,The car is new.,0.95
18
+ Ich habe Hunger.,I am hungry.,0.96
19
+ Guten Morgen!,Good morning!,0.99
20
+ Er spricht Deutsch.,He speaks German.,0.95
21
+ Ich mag Katzen.,I like cats.,0.95
22
+ Sie kocht gern.,She likes cooking.,0.83
23
+ Der Apfel ist rot.,The apple is red.,0.94
24
+ Das Fenster ist offen.,The window is open.,0.95
25
+ Ich wohne in Berlin.,I live in Berlin.,0.97
26
+ Was machst du?,What are you doing?,0.95
27
+ Er spielt Gitarre.,He plays guitar.,0.96
28
+ Wir fahren morgen.,We are leaving tomorrow.,0.87
29
+ Ich verstehe nicht.,I don't understand.,0.76
30
+ Die Katze schläft.,The cat is sleeping.,0.95
31
+ Sie ist meine Freundin.,She is my friend.,0.96
32
+ Ich höre Musik.,I am listening to music.,0.89
33
+ Das Haus ist groß.,The house is big.,0.95
34
+ Er geht zur Schule.,He goes to school.,0.98
35
+ Hast du Zeit?,Do you have time?,0.94
36
+ Ich schreibe einen Brief.,I am writing a letter.,0.93
37
+ Die Tür ist geschlossen.,The door is closed.,0.97
38
+ Sie arbeitet viel.,She works a lot.,0.94
39
+ Ich sehe einen Vogel.,I see a bird.,0.97
40
+ Das Kind lacht.,The child is laughing.,0.96
41
+ Wo wohnst du?,Where do you live?,0.94
42
+ Ich lerne Deutsch.,I am learning German.,0.9
43
+ Kann ich helfen?,Can I help?,0.96
44
+ Das ist mein Bruder.,That is my brother.,0.98
45
+ Sie hat lange Haare.,She has long hair.,0.97
46
+ Wir sind müde.,We are tired.,0.93
47
+ Der Hund bellt.,The dog is barking.,0.86
48
+ Ich esse einen Apfel.,I am eating an apple.,0.94
49
+ Wie heißt du?,What is your name?,0.91
50
+ Mein Name ist Anna.,My name is Anna.,0.99
51
+ Ich liebe dich.,I love you.,0.97
52
+ Es ist sehr spät.,It is very late.,0.98
53
+ Ich habe keine Zeit.,I have no time.,0.95
54
+ Er liest die Zeitung.,He is reading the newspaper.,0.94
55
+ Sie singt ein Lied.,She is singing a song.,0.95
56
+ Ich sehe fern.,I am watching TV.,0.74
57
+ Das ist einfach.,That is easy.,0.93
58
+ Ich gehe einkaufen.,I am going shopping.,0.91
59
+ Wo arbeitest du?,Where do you work?,0.94
60
+ Ich arbeite im Krankenhaus.,I work at the hospital.,0.96
61
+ Sie hat blaue Augen.,She has blue eyes.,0.97
62
+ Wir essen zu Abend.,We are having dinner.,0.89
63
+ Der Himmel ist blau.,The sky is blue.,0.96
64
+ Was kostet das?,How much does that cost?,0.84
65
+ Ich nehme das.,I'll take that.,0.69
66
+ Ich bin krank.,I am sick.,0.92
67
+ Es tut mir leid.,I'm sorry.,0.94
68
+ Ich verstehe dich.,I understand you.,0.95
69
+ Mach das Fenster zu.,Close the window.,0.88
70
+ Wie spät ist es?,What time is it?,0.89
71
+ Ich bin zu Hause.,I am at home.,0.95
72
+ Gute Nacht!,Good night!,0.98
73
+ Sie tanzen gern.,They like to dance.,0.9
74
+ Ich gehe spazieren.,I am going for a walk.,0.9
75
+ Der Kaffee ist heiß.,The coffee is hot.,0.97
76
+ Woher kommst du?,Where are you from?,0.89
77
+ Ich komme aus Deutschland.,I am from Germany.,0.95
78
+ Sie hat ein schönes Lächeln.,She has a beautiful smile.,0.96
79
+ Ich brauche Hilfe.,I need help.,0.94
80
+ Das ist mein Vater.,That is my father.,0.97
81
+ Sie ist meine Mutter.,She is my mother.,0.98
82
+ Ich liebe meine Familie.,I love my family.,0.98
83
+ Heute ist Montag.,Today is Monday.,0.97
84
+ Ich bin glücklich.,I am happy.,0.96
85
+ Er ist traurig.,He is sad.,0.93
86
+ Wir lernen zusammen.,We are learning together.,0.92
87
+ Das ist interessant.,That is interesting.,0.97
88
+ Ich bin bereit.,I am ready.,0.96
89
+ Er ist mein Lehrer.,He is my teacher.,0.98
90
+ Der Ball ist rund.,The ball is round.,0.95
91
+ Ich gehe zur Arbeit.,I am going to work.,0.89
92
+ Sie trägt ein rotes Kleid.,She is wearing a red dress.,0.96
93
+ Ich mag deinen Stil.,I like your style.,0.9
94
+ Er lacht laut.,He is laughing loudly.,0.88
95
+ Wir sehen uns morgen.,See you tomorrow.,0.95
96
+ Ich wünsche dir viel Glück.,I wish you good luck.,0.96
97
+ Bitte sei leise.,Please be quiet.,0.94
98
+ Ich habe es vergessen.,I forgot it.,0.96
99
+ Es ist nicht wichtig.,It is not important.,0.97
100
+ Können wir reden?,Can we talk?,0.96
categories/accuracy.py CHANGED
@@ -77,7 +77,7 @@ def __get_bertscore(src_sentence: str, trg_sentence: str) -> float:
77
  return similarity
78
 
79
 
80
- def __bertscore_to_percentage(similarity: float) -> float:
81
  """
82
  Convert the BERTScore cosine similarity to a percentage score (0-100).
83
 
@@ -89,8 +89,14 @@ def __bertscore_to_percentage(similarity: float) -> float:
89
  """
90
  # Scale the similarity score from [-1, 1] range to [0, 100] (rarely negative)
91
  # Logistic function: 100 / (1 + exp(-k * (x - 0.5))), where k controls steepness
92
- k = 35 # Steepness parameter - higher values create a sharper transition
93
- scaled_score = 100 / (1 + np.exp(-k * (similarity - 0.65)))
 
 
 
 
 
 
94
  return round(scaled_score, 2)
95
 
96
 
 
77
  return similarity
78
 
79
 
80
+ def __bertscore_to_percentage(similarity: float, debug: bool = False) -> float:
81
  """
82
  Convert the BERTScore cosine similarity to a percentage score (0-100).
83
 
 
89
  """
90
  # Scale the similarity score from [-1, 1] range to [0, 100] (rarely negative)
91
  # Logistic function: 100 / (1 + exp(-k * (x - 0.5))), where k controls steepness
92
+ # k = 35 # Steepness parameter - higher values create a sharper transition
93
+
94
+ if debug:
95
+ scaled_score = similarity
96
+ else:
97
+ scaled_score = max(100 / (1 + np.exp(-11 * (similarity - 0.60))), 100 / (1 + np.exp(-5 * (similarity - 0.60))))
98
+
99
+ # scaled_score = similarity
100
  return round(scaled_score, 2)
101
 
102