-
Notifications
You must be signed in to change notification settings - Fork 3
/
report.html.prototype
288 lines (249 loc) · 9.58 KB
/
report.html.prototype
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Evaluation Report</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<style>
.card {
animation-name: fadein;
animation-duration: 1s;
margin-bottom: 25px;
}
@keyframes fadein {
from {
opacity:0;
}
to {
opacity:1;
}
}
.card-user-cov {
background-color: #27A1B7;
color: #86F6F9;
}
.card-cat-cov {
background-color: #956CAE;
color: #FAC0E7;
}
.card-hit-rate {
background-color: #6cae80;
color: #d9fac0;
}
.card-ctr {
background-color: #a55f80;
color: #f9bdd6;
}
.card-diversity {
background-color: #FA8B1C;
color:#F4E588;
}
.card-novelty {
background-color: #ffaf26;
color:#f6f5a2;
}
.card-footer{
background-color: rgb(247,247,247,0.8);
color: black;
font-style: italic;
}
span {
position: relative;
}
span:hover:after {
background: #333;
background: rgba(0, 0, 0, .8);
border-radius: 5px;
bottom: -34px;
color: #fff;
content: attr(gloss);
left: 20%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 350px;
font-size: 14px;
}
span:hover:before {
border: solid;
border-color: #333 transparent;
border-width: 0 6px 6px 6px;
bottom: -4px;
content: "";
left: 50%;
position: absolute;
z-index: 99;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container mt-2">
<nav class="navbar navbar-light bg-light p-2">
<a class="navbar-brand" href="#">RS Evaluation Dashboard</a>
</nav>
<div class="row mt-2 p-2">
<h3>Report</h3>
<p>
<i class="icon-info"></i>
<em class="ml-2">This report contains information about the detailed results of the evaluation process of the recommendation system as well as statistics
related to the ingested dataset of user actions and recommendations</em>
</p>
</div>
<div class="row">
<div class="col-3" >
<div class="card shadow mx-auto">
<div class="card-header" >
📊 General statistics
</div>
<ul class="list-group list-group-flush" >
<li class="list-group-item"><i class="icon-user"></i> Users: <code><span id="val_users"></span></code></li>
<li class="list-group-item"><i class="icon-gift"></i> Recommendations: <code><span id="val_recommendations"></span></code></li>
<li class="list-group-item"><i class="icon-briefcase"></i> Services: <code><span id="val_services"></span></code></li>
</ul>
</div>
</div>
<div class="col-3" >
<div class="card shadow mx-auto has-animation">
<div class="card-header">
🏁 User Actions
</div>
<div class="p-3">
<i class="icon-bolt"></i> <strong>Total Actions: </strong><code><span id="val_user_actions"></span></code>
<ul>
<li><i class="icon-user"></i> by registered users: <code><span id="val_user_actions_registered"></span></code> <br/><small>(<span id="val_user_actions_registered_perc"></span>%)</small></li>
<li><i class="icon-question-sign"></i> by anonymous users: <code><span id="val_user_actions_anonymous"></span></code> <br/><small>(<span id="val_user_actions_anonymous_perc"></span>%)</small></li>
</ul>
</div>
</div>
</div>
<div class="col-3" >
<div class="card shadow mx-auto has-animation">
<div class="card-header">
📒 User Orders
</div>
<div class="p-3">
<i class="icon-archive"></i><strong> Total Orders: </strong><code><span id="val_user_actions_order"></span></code>
<ul>
<li><i class="icon-user"></i> by registered users: <code><span id="val_user_actions_order_registered"></span></code> <br/><small>(<span id="val_user_actions_order_registered_perc"></span>%)</small></li>
<li><i class="icon-question-sign"></i> by anonymous users: <code><span id="val_user_actions_order_anonymous"></span></code> <br/><small>(<span id="val_user_actions_order_anonymous_perc"></span>%)</small></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row mt-2 p-2">
<h4>Metrics</h4>
</div>
<div class="row">
<div class="col-4" >
<div class="card shadow-lg mx-auto card-user-cov">
<div class="card-body m-2 text-center">
<h4><i class="icon-user"></i> User Coverage: <strong><span id="val_user_coverage"></span>%</strong></h4>
</div>
<div class="card-footer"> <p id="doc_user_coverage"></p> </div>
</div>
</div>
<div class="col-4" >
<div class="card shadow-lg mx-auto card-cat-cov">
<div class="card-body m-2 text-center">
<h4><i class="icon-list"></i> Catalog Coverage: <strong><span id="val_catalog_coverage"></span>%</strong></h4>
</div>
<div class="card-footer"> <p id="doc_catalog_coverage"></p> </div>
</div>
</div>
<div class="col-4" >
<div class="card shadow-lg mx-auto card-hit-rate">
<div class="card-body m-2 text-center">
<h4><i class="icon-ok-sign"></i> Hit Rate: <strong><span id="val_hit_rate"></span>%</strong></h4>
</div>
<div class="card-footer"> <p id="doc_hit_rate"></p> </div>
</div>
</div>
<div class="col-5" >
<div class="card shadow-lg mx-auto card-ctr">
<div class="card-body m-2 text-center">
<h4><i class="icon-hand-up"></i> Click-through Rate (CTR): <strong><span id="val_click_through_rate"></span>%</strong></h4>
</div>
<div class="card-footer"> <p id="doc_click_through_rate"></p> </div>
</div>
</div>
<div class="col-5" >
<div class="card shadow-lg mx-auto card-diversity">
<div class="card-body m-2 text-center">
<h4><i class="icon-spinner"></i> Diversity (Shannon Entropy): <strong><span id="val_diversity"></span></strong></h4>
</div>
<div class="card-footer"> <p id="doc_diversity"></p> </div>
</div>
</div>
<div class="col-5" >
<div class="card shadow-lg mx-auto card-diversity">
<div class="card-body m-2 text-center">
<h4><i class="icon-spinner"></i> Diversity (Gini Index): <strong><span id="val_diversity_gini"></span></strong></h4>
</div>
<div class="card-footer"> <p id="doc_diversity_gini"></p> </div>
</div>
</div>
<div class="col-5" >
<div class="card shadow-lg mx-auto card-novelty">
<div class="card-body m-2 text-center">
<h4><i class="icon-star"></i> Novelty: <strong><span id="val_novelty"></span></strong></h4>
</div>
<div class="card-footer"> <p id="doc_novelty"></p> </div>
</div>
</div>
</div>
<div class="col-4">
<h3></h3>
<p>
<i class="icon-clock"></i>
<em class="ml-2"> Generated on: <code><i id="val_timestamp"></i></code> </em>
</p>
</div>
<br/>
</div>
</body>
<script>
function fill(data){
// transform data to flat structure
flat = {}
flat['timestamp'] = data['timestamp']
// add metrics
for (metric of data['metrics']) {
flat[metric['name']] = metric['value']
flat[metric['name'] + '_doc'] = metric['doc']
}
// add statistics
for (stat of data['statistics']) {
flat[stat['name']] = stat['value']
flat[stat['name'] + '_doc'] = stat['doc']
}
// what to fill
let fill_list = ['users', 'recommendations', 'services', 'user_actions','user_actions_order', 'user_actions_registered',
'user_actions_anonymous', 'user_actions_order_registered', 'user_actions_order_anonymous', 'user_actions_registered_perc',
'user_actions_anonymous_perc', 'user_actions_order_registered_perc', 'user_actions_order_anonymous_perc',
'catalog_coverage', 'user_coverage', 'timestamp', 'hit_rate', 'click_through_rate', 'diversity', 'diversity_gini', 'novelty'];
for (item of fill_list) {
key = 'val_' + item
value = flat[item]
value_doc=flat[item+'_doc']
document.getElementById(key).textContent = value
document.getElementById(key).setAttribute('gloss', value_doc);
// Add ui footers with documentation string for some prominent metrics
let doc_el = document.getElementById('doc_'+item);
if (doc_el) {
doc_el.textContent=value_doc;
}
}
}
// Autostart
(function() {
fetch("{{metric_source}}")
.then(response => response.json())
.then(data => fill(data));
}());
</script>
</html>