Re:Show HN: Nekoweb – a retro static web hosting
by dimden on Sunday February 25, 2024 @05:31PM
(#39505600)
sorry im too dumb to comprehend this math
Re:Show HN: Nekoweb – a retro static web hosting
by gnramires on Sunday February 25, 2024 @05:58PM
(#39505811)
No worries :P It's just a way to try to avoid showing the most popular, instead you'd choose randomly from a curve from most popular to least popular, with the chosen index given by i. An easier idea to understand is to pick randomly from the top say 50 websites instead of just showing the most popular ones, avoiding "winner takes all" effects.
Re:Show HN: Nekoweb – a retro static web hosting
by Ringz on Sunday February 25, 2024 @07:21PM
(#39506412)
That’s a good idea!
Re:Show HN: Nekoweb – a retro static web hosting
by gnramires on Sunday February 25, 2024 @09:27PM
(#39507031)
Correction: I've got the integral wrong, of course :)
I've got an expression (after correcting my rusty maths) of
i = k*(n-1+k) / ( (1-r)*(n-1+k)^(p-1) + r*k^(p-1) ) ^ (1/(p-1)) - k
I think there could be precision problems (with p<2 specially)
If I may suggest another algorithm, something like picking from most popular to least with probability ~1/(rank+k)^p, where p is any number >1, for example set p=1.5, k=10.
It can be implemented the following way (by computing the integral of the probability distribution):
(1) Have sorted index by popularity with n items
(2) Pick a random (double) r between 0 and 1
(3) The chosen index is (if I did my integrals right;round to nearest integer):
i = ( k^(p-1)*(n-1+k)^(p-1) / ( (r+1)*(n-1+k)^(p-1) - r*k^(p-1) ) ) ^ 1/(p-1) - k