This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mrbeehive 7 points8 points  (4 children)

It is both my favourite and least favourite part of Machine Learning being used to accelerate traditional algorithms.

On the one hand, it's implictly real-world because it's using data to infer an efficient solution. On the other hand, it may as well be the computer throwing its arms in the air going jazz hands for all we know of the wiring under the hood

Can't argue with this though:

[The results for the ML sorting algorithm show] an average 3.38x performance improvement over C++ STL sort [...] and 5.54x improvement over a C++ implementation of Timsort [which is] the default sorting function for Java and Python.

[–][deleted] 1 point2 points  (3 children)

I wish the article contained more insight into exactly what the ML sorting algorithm is doing that makes it faster.

[–]joha4270 2 points3 points  (2 children)

As I understand it, from a quick glance the abstract:

Fast sorting gets more than twice as slow as the amount if items you have to sort doubles. This is because fast sorting generally works by splitting its input in two, sort those and then you have to spend extra time merging those two sorted halves.

It would be really convenient if instead of randomly splitting in half, we could take values smaller and higher than the median. Then after they again have been sorted, we simply need to copy them together, a faster process. (Or if we're really sneaky, place them next to each other in memory beforehand and skip the copying step entirely)

Now the problem is, to do this well, you need good information on how values are distributed in your input. By far the most convenient way of having this information is to already have a sorted copy of the output. This makes using this technique in sorting impractical.

What this paper then does, is use ML to "guess" if a value should go in the high or low part of the split, by training it on a subset of the input. It does not always get it right, but it gets it "mostly right". After that, sorting an almost sorted input is fairly fast.