-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.txt
105 lines (65 loc) · 1.24 KB
/
todo.txt
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
Salut Dario,
Pardon encore pour le lag.
Je ne me rappelais plus, mais il semble que cela soit calculé dans le backend (dans networkCreator.js:77)
Voila.
Ogier
/**
* Apply transformation to node values (normalize, max, split scholar names, ...)
*/
const
postProcessNodes = (affAcronyms,
nodes)
=> {
const
nullAffinitiesObj = affAcronyms.reduce((o,
v)
=> ({ ...o,
[v]: 0 }), {})
const
averageLab = nodes.reduce((lab,
node)
=> {
affAcronyms.forEach(affinity
=>
lab[affinity] +=
node.metrics.values[affinity] /
nodes.length
)
return
lab
}, affAcronyms.reduce((o,
v)
=> ({ ...o,
[v]: 0 }), {}))
// standardize metrics
nodes.forEach(node
=> {
node.metrics.std = {}
affAcronyms.forEach(affinity
=>
node.metrics.std[affinity] =
node.metrics.values[affinity] ?
node.metrics.values[affinity] /
averageLab[affinity] :
0)
})
// Find scholars picks
nodes.forEach(lab
=> {
lab.metrics.max =
lab.network.nodes.reduce((o,
node)
=> {
affAcronyms.forEach(k
=>
o[k] =
o[k] >
node.metrics.values[k] ?
o[k] :
node.metrics.values[k]
)
return
o
}, { ...nullAffinitiesObj })
})
}