Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Universal Method to Sort Complex Information Found. Parent comment
It does fail the triangle inequality, though, as the following python snippit demonstrates:
import numpy as np def randomvec(): return np.random.rand(4)*2-1 def cossim(a, b): return np.dot(a,b) / np.sqrt(np.dot(a, a) * np.dot(b, b)) def metric(a, b): return -np.log((1+cossim(a, b))/2) def main(): for i in range(20): a = randomvec() b = randomvec() c = randomvec() a2b = metric(a, b) b2c = metric(b, c) a2c = metric(a, c) print a2b, b2c, a2c if a2b + b2c < a2c: print ' *** fails triangle inequality' main()
It does fail the triangle inequality, though, as the following python snippit demonstrates: