8 ms·
The subtitle claims that a “universal way” was found to solve the nearest-neighbour-search problem for any kind of data, but actually the result is restricted t
by macleginn 8y ago
The subtitle claims that a “universal way” was found to solve the nearest-neighbour-search problem for any kind of data, but actually the result is restricted to the (rather huge, of course) set of normed spaces, i.e. spaces whose distance measures obey the triangle inequality.
- bunderbunder 8y agoIt's a rather large set, but it's got some noteworthy holes. Cosine distance, for example.
- DoctorOetker 8y agomy gut feeling tells me - ln((1+Similarity_cosine(A,B))/2) would satisfy the triangle inequality.
- tlb 8y agoIt produces negative distances, which disqualifies it as a metric.
- Y_Y 8y agoFor a Riemannian metric yes, but a lot of physics gets done in Lorentzian (psuedo-)metric spaces.
- DoctorOetker 8y agohow does it produce negative distances? cosine similarity is [1,-1], so add one [2,0], now halve [1,0] now take logarithm [0,-inf] finally negate [0,+inf] ?
- DoctorOetker 8y agoI guess the best conversion of cosine similiarity to distance would of course be d(A,B) = arcCos(Cosine_similiarity(A,B)), i.e. the angle between the 2 directions, which would have the property that subdividing a geodesic arc and calculating the sum of distances along the subdivision results in the same distance as the start and end point.
- tlb 8y agoAh, I mistook the - at the beginning for a separator. 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()
- DoctorOetker 8y agogood catch! upvoted
- deleted 8y ago[deleted]
- sshine 8y agoIncidentally, the zone system for the Danish public transit system is not a metric space. (The ticket you need from A to B is not necessarily the same as from B to A.) That's a kind of practical graph where you want efficient shortest path algorithms for.
- deleted 8y ago[deleted]
- gumby 8y agoReally?? Is that true only when there are multiple paths between A & B or is there something else involved?
- CydeWeys 8y agoOther possibilities: Trains going in different directions don't make the same stops (express vs local), and time-based fares applying to a specific direction based on commuting patterns. In the US, on Amtrak, a ticket is specific to an exact train, like buying a plane ticket. There's no generalized "I want a ticket from DC to NYC."
- bunderbunder 8y agoSome of the shorter ones have unreserved coach class tickets that aren't restricted to a specific train. So, while there is no generalized, "I want a ticket from DC to NYC", there is a generalized, "I want a ticket from Chicago to Milwaukee."
- bunderbunder 8y agoChicago has a minor version of this, even without zone fares: The entry fee to get on a train is $2.50 everywhere except O'Hare Airport, where it's $5.
- gumby 8y agoInteresting, thanks!
- def-lkb 8y ago> spaces whose distance measures obey the triangle inequality That would be a metric space, and a distance obey the triangle inequality by definition. The element of the space are otherwise quite arbitrary. Unfortunately, Normed spaces are a subset of metric spaces which are much less general (in particular they have to be vector spaces).
- macleginn 8y agoYou are right, I wantonly omitted some of the important properties. Cf. the response of one of the authors in another comment on how their method tackles general metric spaces.
- thesasho 8y agoThe method gives a data structure for any metric space, and the quality of the data structure is controlled by how well expanders embed in the metric space. This implies interesting results for metrics which are not norms, like geodesics on certain manifolds. The surprise to us was how well this approach works for any norm, however. (I am one of the authors.) Also, a math correction: spaces which obey the triangle inequality are called metric spaces. The class of normed spaces is more restricted, but still very large.
- macleginn 8y agoBut these more general results are kind of small print, right? The abstracts to both linked articles talk specifically about normed spaces. (Thanks for the correction. I just gave one of the properties, but should’ve been more precise.)
- curious1212 8y agoI don't think the general property of expander graphs is needed, perhaps a relaxed property, such as the following definition: A graph G is a distance(k)-expander if #edges(U, V-U) > c min(#U,#(V-U)) where U is a set of diameter <=k. Now study the embeding. I am also curious about what happens if one use SVM to classify vertices of an expander graph: Let G be an expander graph and let u1,u2 be vertices of G such that d(u1,u2) = diameter of G = an even number 2k. We classify the vertices of G like this: f(u) = 0 if d(u,u1)<=k, f(u)=1 if d(u,u1)>=1, then using SVM applied to the vertices encoded by the rows of the adjancecy matrix. I would expect the SVM algorith to have some special property but I don't know what to expect, the best or worst classification, or the support vectors can gives us some information about symmetries in the graph.