-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable and plot.py
229 lines (212 loc) · 16.2 KB
/
table and plot.py
1
2
3
4
5
6
7
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
rnn = ['Model: SimpleRNN-50-50-1, Optimizer: Adam, last lost: 7.1484460022475105e-06',
'Model: SimpleRNN-100-1, Optimizer: Adam, last lost: 8.823052667139564e-06',
'Model: SimpleRNN-50-1, Optimizer: Adamax, last lost: 1.0893405487877317e-05',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: Adam, last lost: 1.2944186892127618e-05',
'Model: SimpleRNN-50-1, Optimizer: Adam, last lost: 1.68453134392621e-05',
'Model: SimpleRNN-50-50-1, Optimizer: Adamax, last lost: 1.9008082745131105e-05',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: Adamax, last lost: 2.1004654627176933e-05',
'Model: SimpleRNN-50-1, Optimizer: Nadam, last lost: 2.120728458976373e-05',
'Model: SimpleRNN-100-100-1, Optimizer: Adamax, last lost: 2.4231214410974644e-05',
'Model: SimpleRNN-100-1, Optimizer: Adamax, last lost: 2.442320874251891e-05',
'Model: SimpleRNN-100-100-1, Optimizer: SGD, last lost: 3.388046388863586e-05',
'Model: SimpleRNN-100-1, Optimizer: SGD, last lost: 3.389002085896209e-05',
'Model: SimpleRNN-100-100-1, Optimizer: Adagrad, last lost: 3.476670099189505e-05',
'Model: SimpleRNN-100-1, Optimizer: Nadam, last lost: 3.7021618481958285e-05',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: Adam, last lost: 3.967313750763424e-05',
'Model: SimpleRNN-50-1, Optimizer: SGD, last lost: 3.971823753090575e-05',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: SGD, last lost: 4.183324199402705e-05',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: Nadam, last lost: 4.296704355510883e-05',
'Model: SimpleRNN-100-1, Optimizer: Adagrad, last lost: 4.6194210881367326e-05',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: Nadam, last lost: 4.66597884951625e-05',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: Adamax, last lost: 5.6208711612271145e-05',
'Model: SimpleRNN-50-50-1, Optimizer: SGD, last lost: 5.6846984080038965e-05',
'Model: SimpleRNN-100-100-1, Optimizer: Adam, last lost: 6.122249033069238e-05',
'Model: SimpleRNN-50-1, Optimizer: RMSprop, last lost: 6.467275670729578e-05',
'Model: SimpleRNN-50-50-1, Optimizer: Nadam, last lost: 6.788319296902046e-05',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: SGD, last lost: 7.195172656793147e-05',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: Adagrad, last lost: 7.867234671721235e-05',
'Model: SimpleRNN-50-1, Optimizer: Adafactor, last lost: 8.302795322379097e-05',
'Model: SimpleRNN-100-1, Optimizer: RMSprop, last lost: 8.682197949383408e-05',
'Model: SimpleRNN-100-1, Optimizer: Adafactor, last lost: 9.388985927216709e-05',
'Model: SimpleRNN-50-1, Optimizer: Adagrad, last lost: 0.00010135362390428782',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: Adagrad, last lost: 0.00010191676847171038',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: RMSprop, last lost: 0.00010570752783678472',
'Model: SimpleRNN-50-50-1, Optimizer: Adagrad, last lost: 0.0001084331379388459',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: RMSprop, last lost: 0.00010903566726483405',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: Adafactor, last lost: 0.0001349876110907644',
'Model: SimpleRNN-50-50-1, Optimizer: RMSprop, last lost: 0.00015666404215153307',
'Model: SimpleRNN-100-100-1, Optimizer: Adadelta, last lost: 0.00017835885228123516',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: Adafactor, last lost: 0.0001933307503350079',
'Model: SimpleRNN-100-100-1, Optimizer: RMSprop, last lost: 0.0001989090087590739',
'Model: SimpleRNN-50-50-1, Optimizer: Adadelta, last lost: 0.00033994350815191865',
'Model: SimpleRNN-50-50-1, Optimizer: Adafactor, last lost: 0.0005301204510033131',
'Model: SimpleRNN-100-100-1, Optimizer: Adafactor, last lost: 0.0006282638059929013',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: Adadelta, last lost: 0.0007931040017865598',
'Model: SimpleRNN-100-1, Optimizer: Adadelta, last lost: 0.0009286125423386693',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: Adadelta, last lost: 0.001739894854836166',
'Model: SimpleRNN-50-1, Optimizer: Adadelta, last lost: 0.005772875621914864',
'Model: SimpleRNN-50-50-1, Optimizer: Ftrl, last lost: 0.012297271750867367',
'Model: SimpleRNN-100-100-1, Optimizer: Nadam, last lost: 0.029822541400790215',
'Model: SimpleRNN-100-100-1, Optimizer: Ftrl, last lost: 0.05450371280312538',
'Model: Bidirectional-SimpleRNN-50-1, Optimizer: Ftrl, last lost: 0.05807475373148918',
'Model: Bidirectional-SimpleRNN-100-1, Optimizer: Ftrl, last lost: 0.14164793491363525',
'Model: SimpleRNN-100-1, Optimizer: Ftrl, last lost: 0.14277608692646027',
'Model: SimpleRNN-50-1, Optimizer: Ftrl, last lost: 0.16147620975971222']
lstm = ['Model: LSTM-100-1, Optimizer: Adam, last lost: 1.0339412256143987e-05',
'Model: LSTM-100-100-1, Optimizer: Adam, last lost: 1.2349913049547467e-05',
'Model: LSTM-100-1, Optimizer: SGD, last lost: 1.4022998584550805e-05',
'Model: LSTM-50-1, Optimizer: Adam, last lost: 1.5067796994117089e-05',
'Model: LSTM-100-100-1, Optimizer: Adamax, last lost: 1.5245454960677307e-05',
'Model: Bidirectional-LSTM-100-1, Optimizer: Adam, last lost: 1.5491961676161736e-05',
'Model: LSTM-100-1, Optimizer: Adamax, last lost: 1.559750126034487e-05',
'Model: LSTM-50-50-1, Optimizer: Adam, last lost: 1.5863315638853237e-05',
'Model: LSTM-50-1, Optimizer: Nadam, last lost: 1.6074234736151993e-05',
'Model: LSTM-100-1, Optimizer: Nadam, last lost: 1.767165849742014e-05',
'Model: Bidirectional-LSTM-50-1, Optimizer: Adam, last lost: 1.9828763470286503e-05',
'Model: LSTM-50-50-1, Optimizer: Adamax, last lost: 2.043077620328404e-05',
'Model: LSTM-50-1, Optimizer: Adamax, last lost: 2.0753839635290205e-05',
'Model: Bidirectional-LSTM-50-1, Optimizer: Nadam, last lost: 2.703026621020399e-05',
'Model: LSTM-50-50-1, Optimizer: Nadam, last lost: 2.841568857547827e-05',
'Model: Bidirectional-LSTM-100-1, Optimizer: Adamax, last lost: 2.8701555493171327e-05',
'Model: Bidirectional-LSTM-100-1, Optimizer: Nadam, last lost: 3.527190347085707e-05',
'Model: LSTM-100-100-1, Optimizer: SGD, last lost: 3.6755187466042116e-05',
'Model: Bidirectional-LSTM-50-1, Optimizer: Adamax, last lost: 3.71811656805221e-05',
'Model: Bidirectional-LSTM-100-1, Optimizer: SGD, last lost: 4.006939707323909e-05',
'Model: LSTM-100-100-1, Optimizer: Nadam, last lost: 4.2655414290493354e-05',
'Model: LSTM-50-1, Optimizer: Adafactor, last lost: 4.704422826762311e-05',
'Model: Bidirectional-LSTM-50-1, Optimizer: SGD, last lost: 6.383193976944312e-05',
'Model: LSTM-100-1, Optimizer: Adafactor, last lost: 7.01018943800591e-05',
'Model: LSTM-100-100-1, Optimizer: Adagrad, last lost: 7.49484242987819e-05',
'Model: Bidirectional-LSTM-50-1, Optimizer: Adafactor, last lost: 8.77444981597364e-05',
'Model: Bidirectional-LSTM-100-1, Optimizer: Adafactor, last lost: 9.765525464899838e-05',
'Model: LSTM-50-50-1, Optimizer: Adafactor, last lost: 9.819125989452004e-05',
'Model: LSTM-50-1, Optimizer: SGD, last lost: 0.00010430644761072472',
'Model: Bidirectional-LSTM-50-1, Optimizer: RMSprop, last lost: 0.00012001615687040612',
'Model: LSTM-100-100-1, Optimizer: Adafactor, last lost: 0.00012728323054034263',
'Model: LSTM-50-1, Optimizer: RMSprop, last lost: 0.00012728404544759542',
'Model: LSTM-100-1, Optimizer: RMSprop, last lost: 0.00013790529919788241',
'Model: Bidirectional-LSTM-100-1, Optimizer: RMSprop, last lost: 0.00014845369150862098',
'Model: LSTM-50-50-1, Optimizer: SGD, last lost: 0.00015427528705913574',
'Model: LSTM-50-50-1, Optimizer: RMSprop, last lost: 0.0002789665886666626',
'Model: LSTM-100-100-1, Optimizer: RMSprop, last lost: 0.0003185785317327827',
'Model: LSTM-50-50-1, Optimizer: Adagrad, last lost: 0.0003287503495812416',
'Model: Bidirectional-LSTM-100-1, Optimizer: Adagrad, last lost: 0.00159243936650455',
'Model: LSTM-100-1, Optimizer: Adagrad, last lost: 0.002229538280516863',
'Model: Bidirectional-LSTM-50-1, Optimizer: Adagrad, last lost: 0.00334408157505095',
'Model: LSTM-50-1, Optimizer: Adagrad, last lost: 0.006197857670485973',
'Model: LSTM-100-100-1, Optimizer: Adadelta, last lost: 0.01089305430650711',
'Model: Bidirectional-LSTM-100-1, Optimizer: Adadelta, last lost: 0.066889688372612',
'Model: Bidirectional-LSTM-50-1, Optimizer: Adadelta, last lost: 0.12039549648761749',
'Model: LSTM-50-50-1, Optimizer: Adadelta, last lost: 0.12757839262485504',
'Model: LSTM-50-1, Optimizer: Adadelta, last lost: 0.14293380081653595',
'Model: LSTM-100-1, Optimizer: Adadelta, last lost: 0.14473316073417664',
'Model: Bidirectional-LSTM-50-1, Optimizer: Ftrl, last lost: 0.1608467698097229',
'Model: LSTM-50-1, Optimizer: Ftrl, last lost: 0.1626897007226944',
'Model: Bidirectional-LSTM-100-1, Optimizer: Ftrl, last lost: 0.1633821725845337',
'Model: LSTM-100-1, Optimizer: Ftrl, last lost: 0.1633947789669037',
'Model: LSTM-50-50-1, Optimizer: Ftrl, last lost: 0.16430321335792542',
'Model: LSTM-100-100-1, Optimizer: Ftrl, last lost: 0.16444629430770874']
gru = ['Model: GRU-50-50-1, Optimizer: Adam, last lost: 4.707890639110701e-06',
'Model: GRU-100-1, Optimizer: Adam, last lost: 4.766522579302546e-06',
'Model: GRU-100-100-1, Optimizer: Adam, last lost: 4.789349077327643e-06',
'Model: GRU-50-50-1, Optimizer: Nadam, last lost: 5.012138444726588e-06',
'Model: GRU-100-1, Optimizer: Nadam, last lost: 5.165178663446568e-06',
'Model: GRU-100-1, Optimizer: SGD, last lost: 5.4459974307974335e-06',
'Model: GRU-50-1, Optimizer: Adafactor, last lost: 5.4775073294877075e-06',
'Model: GRU-100-100-1, Optimizer: Adamax, last lost: 5.480169420479797e-06',
'Model: GRU-50-1, Optimizer: Nadam, last lost: 5.524032530956902e-06',
'Model: GRU-50-50-1, Optimizer: Adamax, last lost: 5.756230166298337e-06',
'Model: GRU-50-1, Optimizer: Adam, last lost: 6.245525128178997e-06',
'Model: GRU-100-1, Optimizer: Adamax, last lost: 6.366941761370981e-06',
'Model: GRU-50-1, Optimizer: Adamax, last lost: 6.431740985135548e-06',
'Model: GRU-100-100-1, Optimizer: SGD, last lost: 7.98496330389753e-06',
'Model: GRU-50-1, Optimizer: SGD, last lost: 8.672521289554425e-06',
'Model: GRU-100-1, Optimizer: Adafactor, last lost: 9.935271918948274e-06',
'Model: Bidirectional-GRU-100-1, Optimizer: Adam, last lost: 1.5871399227762595e-05',
'Model: Bidirectional-GRU-50-1, Optimizer: Nadam, last lost: 1.592828266439028e-05',
'Model: GRU-50-50-1, Optimizer: SGD, last lost: 1.6886509911273606e-05',
'Model: Bidirectional-GRU-100-1, Optimizer: Nadam, last lost: 1.7679689335636795e-05',
'Model: Bidirectional-GRU-100-1, Optimizer: Adamax, last lost: 2.0068768208147958e-05',
'Model: GRU-50-50-1, Optimizer: Adafactor, last lost: 2.0379035049700178e-05',
'Model: Bidirectional-GRU-50-1, Optimizer: SGD, last lost: 2.297994251421187e-05',
'Model: Bidirectional-GRU-50-1, Optimizer: Adam, last lost: 2.3093560230336152e-05',
'Model: Bidirectional-GRU-100-1, Optimizer: SGD, last lost: 2.64266363956267e-05',
'Model: GRU-100-100-1, Optimizer: Nadam, last lost: 2.6985300792148337e-05',
'Model: Bidirectional-GRU-50-1, Optimizer: Adafactor, last lost: 2.754455454123672e-05',
'Model: GRU-100-100-1, Optimizer: Adafactor, last lost: 2.7930365831707604e-05',
'Model: Bidirectional-GRU-100-1, Optimizer: Adafactor, last lost: 2.8062393539585173e-05',
'Model: Bidirectional-GRU-50-1, Optimizer: Adamax, last lost: 3.0205099392333068e-05',
'Model: GRU-50-1, Optimizer: RMSprop, last lost: 0.00012124768545618281',
'Model: Bidirectional-GRU-50-1, Optimizer: RMSprop, last lost: 0.00013024966756347567',
'Model: GRU-100-1, Optimizer: RMSprop, last lost: 0.00013586990826297551',
'Model: Bidirectional-GRU-100-1, Optimizer: RMSprop, last lost: 0.00018074044783134013',
'Model: GRU-50-50-1, Optimizer: RMSprop, last lost: 0.00024269278219435364',
'Model: GRU-100-100-1, Optimizer: RMSprop, last lost: 0.0003259317309129983',
'Model: GRU-100-100-1, Optimizer: Adagrad, last lost: 0.0020435492042452097',
'Model: Bidirectional-GRU-100-1, Optimizer: Adagrad, last lost: 0.0027248687110841274',
'Model: GRU-50-50-1, Optimizer: Adagrad, last lost: 0.004130566027015448',
'Model: GRU-100-1, Optimizer: Adagrad, last lost: 0.006076014135032892',
'Model: Bidirectional-GRU-50-1, Optimizer: Adagrad, last lost: 0.006933880504220724',
'Model: GRU-100-100-1, Optimizer: Adadelta, last lost: 0.007357695139944553',
'Model: GRU-50-1, Optimizer: Adagrad, last lost: 0.00936937890946865',
'Model: Bidirectional-GRU-100-1, Optimizer: Adadelta, last lost: 0.06046106666326523',
'Model: Bidirectional-GRU-50-1, Optimizer: Ftrl, last lost: 0.07972640544176102',
'Model: GRU-50-1, Optimizer: Adadelta, last lost: 0.10427102446556091',
'Model: GRU-100-1, Optimizer: Adadelta, last lost: 0.10565608739852905',
'Model: GRU-50-1, Optimizer: Ftrl, last lost: 0.11111944168806076',
'Model: GRU-100-1, Optimizer: Ftrl, last lost: 0.11140456795692444',
'Model: Bidirectional-GRU-100-1, Optimizer: Ftrl, last lost: 0.11382657289505005',
'Model: GRU-50-50-1, Optimizer: Adadelta, last lost: 0.1153414323925972',
'Model: GRU-100-100-1, Optimizer: Ftrl, last lost: 0.14568881690502167',
'Model: GRU-50-50-1, Optimizer: Ftrl, last lost: 0.1479225903749466',
'Model: Bidirectional-GRU-50-1, Optimizer: Adadelta, last lost: 0.21434378623962402']
import pandas as pd
# Function to parse a list of model data strings into a DataFrame
def parse_model_data(model_data):
data = []
for record in model_data:
parts = record.split(", ")
model = parts[0].split(": ")[1]
optimizer = parts[1].split(": ")[1]
loss = float(parts[2].split(": ")[1])
data.append({"Model": model, "Optimizer": optimizer, "Last Loss": loss})
return pd.DataFrame(data)
# Parsing the data
rnn_df = parse_model_data(rnn)
lstm_df = parse_model_data(lstm)
gru_df = parse_model_data(gru)
rnn_df.to_csv("rnn.csv", index_label="Rank", index=True)
lstm_df.to_csv("lstm.csv", index_label="Rank", index=True)
gru_df.to_csv("gru.csv", index_label="Rank", index=True)
# Combining all data into a single DataFrame
combined_df = pd.concat([rnn_df, lstm_df, gru_df], ignore_index=True)
combined_df.head() # Display the first few rows of the combined DataFrame
import matplotlib.pyplot as plt
import numpy as np
# Function to plot data with logarithmic scale and jitter
def plot_data_log_jitter(df, title):
plt.figure(figsize=(15, 6))
unique_optimizers = df['Optimizer'].unique()
colors = plt.cm.get_cmap('tab20', len(unique_optimizers))
# Creating jitter
x_labels = df['Model'].unique()
x_positions = np.arange(len(x_labels))
model_to_xpos = {model: pos for model, pos in zip(x_labels, x_positions)}
for i, optimizer in enumerate(unique_optimizers):
# Filter data for each optimizer
optimizer_data = df[df['Optimizer'] == optimizer]
jittered_x = [model_to_xpos[model] + np.random.uniform(-0.3, 0.3) for model in optimizer_data['Model']]
plt.scatter(jittered_x, optimizer_data['Last Loss'], label=optimizer, color=colors(i), alpha=0.7)
plt.yscale('log') # Logarithmic scale for the y-axis
plt.xticks(ticks=x_positions, labels=x_labels, rotation=90)
plt.xlabel('Model')
plt.ylabel('Last Loss (log scale)')
plt.title(title)
plt.legend()
plt.grid(True, which="both", ls="--")
plt.tight_layout()
plt.show()
# Plotting data with logarithmic scale and jitter
plot_data_log_jitter(rnn_df, 'RNN Models Loss Visualization (Log Scale)')
plot_data_log_jitter(lstm_df, 'LSTM Models Loss Visualization (Log Scale)')
plot_data_log_jitter(gru_df, 'GRU Models Loss Visualization (Log Scale)')