-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot-all-models.js
More file actions
162 lines (148 loc) · 10.8 KB
/
plot-all-models.js
File metadata and controls
162 lines (148 loc) · 10.8 KB
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
function sin() { return [
"1 119.10928349263607 94.42665737193585 74.93222186186394 67.03097269310102 65.43302771937698 66.08360360053855 67.16197498619614 68.03529583958529 68.61746032645722",
"2 98.85175507262677 88.62321066880564 76.99310670297115 67.88459602352735 64.23250986937362 64.41792376837054 65.72167224091575 67.0158401881082 67.98501693294251",
"4 81.34806941873399 78.10101909301558 73.37755137341459 67.83655420426682 63.48913691595159 62.46662233750974 63.755356000668726 65.4780839483914 66.94327150104725",
"8 70.92217604719836 69.942346743504 68.37663390608208 66.01563463251298 63.141905667616506 61.09363610224701 61.45281248504743 63.345629035954566 65.35195540600358",
"16 65.29226977061248 64.97251584021414 64.48034106673889 63.675604800249566 62.391744659321546 60.78347588310972 59.89829481709381 60.9230358126676 63.162393358185064",
"32 62.34269961793457 62.247806102015176 62.078518954464975 61.7954874322501 61.35731583891588 60.55193252694043 59.553975729061264 59.26003509068689 60.654324233128996",
"64 60.84342886958761 60.79513360753218 60.73753547386994 60.614906484806646 60.469425755630596 60.154532347872774 59.66577429441621 58.958125675625574 58.93039114327079",
"128 60.07109643369507 60.04125275782196 60.0154656172615 59.960884415242894 59.871003487364845 59.765660790845516 59.56740263511966 59.181626166401934 58.64301169424656",
"256 59.68050908714191 59.66053540863022 59.63934620345335 59.620700598641974 59.594586897649194 59.52971115600702 59.43025128595583 59.265234760377076 58.96935151106595",
"512 59.48157472080042 59.467170197025055 59.45908302202492 59.43710630226593 59.42134978705572 59.40133410184206 59.32568115101059 59.25606321877556 59.112811505838785",
];}
function antsin() { return [
"1 108.24332708767871 84.75480194597897 67.42203614621639 59.90889529221101 58.15063905402231 58.4885652403645 59.243399108460025 59.85152100141511 60.23166183438734",
"2 87.60127195765386 78.40142416863242 68.31554353798924 60.63185604667936 57.53728347283602 57.4690578188038 58.32676417456451 59.23388431823754 59.87219212252095",
"4 71.12043493629344 68.3186602736751 64.31088204097651 59.77525773197484 56.630072711834416 56.06433061545517 57.00849248866421 58.24391399972302 59.23214770442778",
"8 62.22847748662684 61.375497113495356 59.98267566553384 57.93212396621339 55.69381317804543 54.593928184039775 55.30043737700782 56.79064941019998 58.206771225110124",
"16 57.82642424644876 57.512639862947 57.003789585114426 56.17272646841511 54.963773032790485 53.75882716972371 53.60847603444982 54.91863668708159 56.67641689384354",
"32 55.62468259445829 55.511690967076674 55.33056792152427 54.96021563059271 54.38282341905543 53.55097149793084 52.80220805882467 53.133770086172134 54.72723542382285",
"64 54.5707705197073 54.48987334903803 54.40022943211915 54.25289200792786 53.98025859022582 53.51294804744207 52.84468986477932 52.361912815273485 52.886784248318186",
"128 54.02126765044344 53.97880470995921 53.94884886063452 53.84908990023916 53.72022393746086 53.49044918400013 53.06713611393902 52.53207017946537 52.12269637977611",
"256 53.75776917559852 53.74088562158489 53.706960919628166 53.668312588712176 53.59487408806167 53.47167359883393 53.22709551307239 52.849420561654675 52.32602113421692",
"512 53.64487172522379 53.63113277872201 53.60484690342173 53.568297015946 53.51011364624193 53.44668195482652 53.34837222696369 53.124832431948604 52.75219067042494",
];}
function ant() {return [
"1 116.10066748628817 93.58335998359736 72.30661143501504 62.27720071093125 60.06992472050609 60.73267817246068 61.74914848804931 62.48115846959265 62.89812524036322",
"2 93.87805622709773 83.7385477003671 72.01447926883147 62.688173273882725 58.973884235337316 59.097035543177604 60.44273693727418 61.669709256853636 62.44471465638263",
"4 74.50667649814088 71.05883159316735 66.34233794318688 61.15202506386825 57.54875135670738 57.029724598532205 58.50934108469966 60.29231782067459 61.63647084403368",
"8 63.64847027498588 62.50080694442782 60.73657934813844 58.43326735950994 56.03572664376153 55.02441509770391 56.10091593089306 58.22282501364043 60.198083686091294",
"16 58.36540585050545 57.87349125228228 57.14254429236747 56.11035406801935 54.76584009462519 53.66968679439099 53.76469034761846 55.60997448795931 58.05849739227028",
"32 55.78015039025738 55.53637989777202 55.20415199190526 54.6617300949046 53.908718964846784 53.05974655815897 52.504213152837615 53.180622594342914 55.3542056255901",
"64 54.51045119947824 54.41480298610247 54.21384258321936 53.881670414017734 53.423485841559234 52.83942129115127 52.227767555349395 51.93993162583986 52.87024528134374",
"128 53.91951868283917 53.84678431551989 53.71180983350082 53.53417470073437 53.276097684446086 52.846883932098805 52.29456810073832 51.80047999223831 51.654416160031474",
"256 53.65809806210005 53.6096167155629 53.49684247006996 53.36614848581025 53.19662855307784 52.95826911769589 52.5413634610871 52.04287405906284 51.59881085750679",
"512 53.52770108544103 53.4855957695406 53.41286518862265 53.33007605120218 53.20799070429656 53.022270555898 52.78303816254403 52.37894310145462 51.90171407293587",
];}
function augmix() {return [
"1 122.5628987617301 99.72269428270732 76.23084573122927 65.45509973464162 62.08388302858822 61.784938956414905 62.69775513022331 63.74697400164069 64.46626956416289",
"2 100.39147214877708 88.68690723577734 75.15852668550727 64.86370615831363 60.93333284790252 60.51175908798683 61.27775246027148 62.515823678782894 63.67017423544158",
"4 78.54605501526879 74.40883044502834 68.69066420639464 62.52407537714064 58.5754321150564 58.298880476102 59.525484579046015 60.94156610382968 62.38698422152895",
"8 65.02317285279504 63.812944491456726 61.85727827532872 59.20592131950458 56.387211015987425 55.40463201977293 56.87279883823964 59.00200827921917 60.76856077181669",
"16 58.01554600473784 57.554282306221296 56.96298014907466 56.01869938696354 54.68584610759091 53.44274734385285 53.7806587893688 56.14706086371678 58.711258997191614",
"32 54.367337145740166 54.203979161157385 53.99390800188287 53.68440194491807 53.21399991204273 52.498745698683805 51.994213859106736 53.01256544681131 55.78202979932404",
"64 52.54575622129885 52.49830706011858 52.37628381028706 52.24211135969764 52.069968908148226 51.82572373119093 51.39361122549565 51.250220320140066 52.58817883051037",
"128 51.64292420827661 51.598858989630756 51.54154740214709 51.4660604297306 51.37511830649499 51.2598278970905 51.09690284033368 50.87718706218347 50.89377487851835",
"256 51.1807581574446 51.170327604108316 51.12328559956012 51.080657493209365 51.01810521834149 50.94825648084124 50.85788526440476 50.763334838318436 50.595220161505175",
"512 50.96217857415549 50.95185760730877 50.928764564742565 50.90358904338263 50.857929288549954 50.798438050560165 50.716142949257474 50.64801592827145 50.608023032255495",
];}
function resnet() { return [
"1 117.76347998289627 98.78204232336087 81.06034887067212 72.80300883461567 71.38861062744097 72.71990378142216 74.27782406633183 75.36099885981866 75.99204264878614",
"2 98.1069741040071 89.92144586928688 80.13077056793188 72.36480949399913 69.62747322103512 70.39114872268541 72.38924621768525 74.15682821745473 75.31889691729624",
"4 81.10100187757952 78.44847161251687 74.69953270173924 70.27082717254555 67.48242437174754 67.6904731073378 69.77048836809124 72.18993843924682 74.09759224750118",
"8 71.55582619018772 70.74209290063366 69.4443203137375 67.56468164231653 65.59502489626844 65.01506830595775 66.70345843504107 69.40705004333445 72.06583874327482",
"16 66.82469633022842 66.51565061819355 66.05690375785903 65.32241768816706 64.28977107983523 63.32361206554857 63.81447515797938 66.18943682682222 69.24373089412305",
"32 64.5135666208424 64.38599262876306 64.19001326615748 63.87451203820042 63.38240845989348 62.715366882402776 62.213168144497 63.21920948370088 65.93774710516307",
"64 63.33476638353901 63.28029602989225 63.1901863914968 63.045416224694165 62.809270910311774 62.433015411160234 61.949442070158284 61.683765702978114 62.89921031044136",
"128 62.784826064972684 62.74618086918987 62.68838730116092 62.620346351976366 62.49820489333874 62.286506888816874 61.99787400504834 61.56296132737949 61.41646877975859",
"256 62.509551018476365 62.48624346921706 62.43921453753365 62.40875450318077 62.3169850668038 62.22350746858932 62.01378376893843 61.73406300339377 61.3541850950713",
"512 62.35897365354837 62.361086803808384 62.334339765087606 62.291011082293515 62.2604079861532 62.174954148063975 62.06443219896012 61.89542467662033 61.617028764070916",
];}
function get_datasets_priors(f) {
prior_tables = {};
[sin, ant, antsin, augmix, resnet].forEach(func => {
priors_header = ["batchsize",1,2,4,16,32,64,128,256];
table = make_table(func(), priors_header);
prior_tables[func] = table;
})
table = prior_tables[f];
datasets = [];
console.log("Table");
console.log(table);
[1,2,4,16,32,64,128,256].forEach((pseudoBsz, index) => {
console.log(table[pseudoBsz]);
entry = {
label: `${pseudoBsz}`,
data: [],
borderColor: `rgba(0, 0, 0, ${.2+index/10})`,
//borderColor: colorMap[table.modelclass[index]],
//backgroundColor: colorMap[table.modelclass[index]],
fill: false
}
table.batchsize.forEach((bsz, idx) => {
entry.data.push(
{ x : bsz, y : table[pseudoBsz][idx]}
);
});
datasets.push(entry);
});
return datasets;
}
function update_config_priors(func) {
return {
type: 'line',
data: {
datasets: get_datasets_priors(func)
},
options: {
animation: {
"easing" : "linear"
},
responsive: true,
title: {
display: false,
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true
},
legend: {
title: "x",
display: true,
},
scales: {
xAxes: [{
display: true,
type: "logarithmic",
ticks: {
min: 1,
max: 256,
callback: function(label, index, labels) {
return label;
}
},
scaleLabel: {
display: true,
labelString: '# Samples'
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Mean Corruption Error'
},
ticks: {
min: 50,
max: 100
},
}]
}
}
};
}
var config_priors = update_config_priors(resnet);