Published
Edited
Dec 4, 2019
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
longtermPower = aliasMap((a) => totalCred.get(a) / sumTotalCred)
Insert cell
totalCred = aliasMap((a) => d3.sum(cred.get(a)))
Insert cell
cred = aliasMap((a) => intervalCred.has(a) ? intervalCred.get(a).slice(0, last_week_idx+1) : []);
Insert cell
rawRecent = aliasMap((a) => Math.sqrt(d3.sum(timeDecay(cred.get(a)))))
Insert cell
sumRawRecent = d3.sum(Array.from(rawRecent.values()))
Insert cell
timeDecay = (credArray) => credArray.map((x, i) => x * Math.pow(expDecay, credArray.length - i - 1))
Insert cell
expDecay = 0.9
Insert cell
recentPower = aliasMap((a) => rawRecent.get(a) / sumRawRecent)
Insert cell
sumTotalCred = d3.sum(Array.from(totalCred.values()))
Insert cell
Insert cell
Insert cell
Insert cell
grainBalance = aliasMap((a) => pastPayout.get(a) + transfers.get(a))
Insert cell
sumGrainBalance = d3.sum(Array.from(grainBalance.values()))
Insert cell
grainPower = aliasMap((a) => grainBalance.get(a) / sumGrainBalance)
Insert cell
grainPower.get("sourcecred/@protocol")
Insert cell
totalPower = aliasMap((a) => (longtermPower.get(a) + recentPower.get(a) + grainPower.get(a)) / 3)
Insert cell
Insert cell
Insert cell
Insert cell
percentFormat = d3.format(".1%")
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more