forked from karpathy/nipspreview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nipsnice_template.html
311 lines (256 loc) · 6.96 KB
/
nipsnice_template.html
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NIPS 2012 Accepted Papers</title>
<style>
/* CSS */
body {
margin: 0;
padding: 0;
font-family: arial;
background-color: #F6F3E5;
}
.as {
font-size: 12px;
color: #900;
}
.ts {
font-weight: bold;
font-size: 14px;
}
.tt {
color: #009;
font-size: 13px;
}
h1 {
font-size: 20px;
padding: 0;
margin: 0;
}
#titdiv {
width: 100%;
height: 90px;
background-color: #840000;
color: white;
padding-top: 20px;
padding-left: 20px;
border-bottom: 1px solid #540000;
}
#maindiv {
width: 970px;
padding: 15px;
margin-left: auto;
margin-right: auto;
border-left: solid 1px #D6D3C5;
border-right: solid 1px #D6D3C5;
background-color: white;
}
.apaper {
margin-top: 25px;
min-height: 300px;
}
.paperdesc {
float: left;
}
.dllinks {
float: right;
text-align: right;
}
#titdiv a:link{ color: white; }
#titdiv a:visited{ color: white; }
#maindiv a:link{ color: #666; }
#maindiv a:visited{ color: #600; }
.t0 { color: #000;}
.t1 { color: #C00;}
.t2 { color: #0C0;}
.t3 { color: #00C;}
.t4 { color: #AA0;}
.t5 { color: #C0C;}
.t6 { color: #0CC;}
.topicchoice {
border: 2px solid black;
border-radius: 10px;
padding: 4px;
cursor: pointer;
text-decoration: underline;
}
#explanation {
background-color: #CFC;
border-radius: 5px;
color: black;
padding: 5px;
text-align: center;
}
#sortoptions {
text-align: center;
padding: 10px;
}
.sim {
cursor: pointer;
text-decoration: underline;
}
.abstr {
cursor: pointer;
text-decoration: underline;
}
.abstrholder {
background-color: #DFD;
border: 1px solid #BDB;
font-size: 12px;
padding: 10px;
border-radius: 5px;
display: none; /* so that these are hidden initially */
margin-bottom: 5px;
}
</style>
<script src="jquery-1.8.3.min.js"></script>
<script>
// this line below will get filled in with database of LDA topic distributions for top words
// for every paper
LOADDISTS
// this will be filled with pairwise scores between papers
PAIRDISTS
var choices = [0, 0, 0, 1, 1, 0, 0]; // default choices, random...
var similarityMode = 0; // is the user currently looking at papers similar to some one paper?
var similarTo = 0; // the index of query paper
// given choices of topics to sort by, handle user interface stuff (i.e. show selection)
function colorChoices() {
for(var i=0;i<choices.length;i++) {
if(choices[i] == 1) {
$("#tc"+i).css("background-color", "#EFE");
$("#tc"+i).css("border-color", "#575");
} else {
$("#tc"+i).css("background-color", "#FFF");
$("#tc"+i).css("border-color", "#FFF");
}
}
}
// this permutes the divs (that contian 1 paper each) based on a custom sorting function
// in our case, this sort is done as dot product based on the choices[] array
// here we are guaranteed ldadist[] already sums to 1 for every paper
function arrangeDivs() {
var rtable = $("#rtable");
var paperdivs = rtable.children(".apaper");
// normalize choices to sum to 1
var nn = choices.slice(0); // copy the array
var ss = 0.0;
for(var j=0;j<choices.length;j++) { ss += choices[j]; }
for(var j=0;j<choices.length;j++) { nn[j] = nn[j]/ss; }
paperdivs.detach().sort(function(a,b) {
var ixa = parseInt($(a).attr('id').substring(3));
var ixb = parseInt($(b).attr('id').substring(3));
if(similarityMode === 1) {
return pairdists[ixa][similarTo] < pairdists[ixb][similarTo] ? 1 : -1;
}
if(similarityMode === 0) {
// chi-squared kernel for the two histograms
var accuma = 0;
var accumb = 0;
for(var i=0;i<7;i++) {
var ai= ldadist[ixa][i];
var bi= ldadist[ixb][i];
var ci= choices[i];
accuma += (ai-ci)*(ai-ci)/(ai+ci);
accumb += (bi-ci)*(bi-ci)/(bi+ci);
}
return accuma > accumb ? 1 : -1;
/*
// vector distance. These are histograms... but lets pretend they arent
var accuma = 0;
var accumb = 0;
for(var i=0;i<7;i++) {
var ai= ldadist[ixa][i];
var bi= ldadist[ixb][i];
var ci= nn[i];
accuma += (ai-ci)*(ai-ci);
accumb += (bi-ci)*(bi-ci);
}
return accuma > accumb ? 1 : -1;
*/
/*
// inner product distance
var accuma = 0;
var accumb = 0;
for(var i=0;i<7;i++) {
accuma += ldadist[ixa][i] * choices[i];
accumb += ldadist[ixb][i] * choices[i];
}
return accuma < accumb ? 1 : -1;
*/
}
});
rtable.append(paperdivs);
}
// when page loads...
$(document).ready(function(){
arrangeDivs();
colorChoices();
// user clicks on one of the Topic buttons
$(".topicchoice").click(function() {
similarityMode = 0; // make sure this is off
var tcid = parseInt($(this).attr('id').substring(2));
choices[tcid] = 1 - choices[tcid]; // toggle!
colorChoices();
arrangeDivs();
});
// user clicks on "rank by tf-idf similarity to this" button for some paper
$(".sim").click(function() {
similarityMode = 1; // turn on similarity mode
for(var i=0;i<choices.length;i++) { choices[i] = 0; } // zero out choices
similarTo = parseInt($(this).attr('id').substring(3)); // store id of the paper clicked
colorChoices();
arrangeDivs();
// also scroll to top
$('html, body').animate({ scrollTop: 0 }, 'fast');
});
// user clicks on "abstract button for some paper
$(".abstr").click(function() {
var pid = parseInt($(this).attr('id').substring(2)); // id of the paper clicked
var aurl = "abstracts/a" + pid + ".txt";
var holderdiv = "#abholder" + pid;
if($(holderdiv).is(':visible')) {
$(holderdiv).slideUp(); // hide the abstract away
} else {
// do ajax request and fill the abstract div with the result
$.ajax({
url : aurl,
dataType: "text",
success : function (data) {
$(holderdiv).html(data);
$(holderdiv).slideDown();
}
});
}
});
});
</script>
</head>
<body>
<div id ="titdiv">
<h1>NIPS 2012 papers</h1>
(in nicer format than <a href="http://books.nips.cc/nips25.html">this)</a><br />
maintained by <a href="https://twitter.com/karpathy">@karpathy</a><br/>
source code on <a href="https://github.com/karpathy/nipspreview">github</a>
</div>
<div id="maindiv">
<div id="explanation">Below every paper are TOP 100 most-occuring words in that paper and their color is based on LDA topic model with k = 7.<br />
<div style="font-size: 12px;">(It looks like 0 = theory, 1 = reinforcement learning, 2 = graphical models, 3 = deep learning/vision, 4 = optimization, 5 = neuroscience, 6 = embeddings etc.) </div>
</div>
<div id="sortoptions">
Toggle LDA topics to sort by:
<span class="topicchoice t0" id="tc0">TOPIC0</span>
<span class="topicchoice t1" id="tc1">TOPIC1</span>
<span class="topicchoice t2" id="tc2">TOPIC2</span>
<span class="topicchoice t3" id="tc3">TOPIC3</span>
<span class="topicchoice t4" id="tc4">TOPIC4</span>
<span class="topicchoice t5" id="tc5">TOPIC5</span>
<span class="topicchoice t6" id="tc6">TOPIC6</span>
</div>
<!-- the keyword below will be replaced by content from the python script generatenice.py -->
<div id="rtable">
RESULTTABLE
</div>
</div>
<br /><br /><br /><br /><br /><br />
</body>
</html>