2 ms·
"C is faster" is a tired argument. The ability of this compiler or that to produce the most efficient possible code is almost never relevant outside of a few ni
by danieldk 15y ago
"C is faster" is a tired argument. The ability of this compiler or that to produce the most efficient possible code is almost never relevant outside of a few niche cases.
What niches? ML is exactly one of the niches where highly optimized code helps tremendously. We use ML, amongst other things, for parse disambiguation and fluency ranking. Making a modification in, say the grammar, often results in training and retraining various components that have a mutual influence (e.g. parse disambiguation, auxiliary distributions for subcategorization frames, the part of speech tagger). Evaluation is also performed using ten-fold cross validation.
Since a modification can also result in regressions, the effect of modifications are usually checked individually. Being able to validate changes in one hour rather than one day, helps the development of such a system tremendously.
We developed some software first in other languages (Java, Scala, Python), usually to make a prototype for getting grip on a problem. But reimplementing it in C or C++ paid of tremendously on each occasion. Even though there is enough CPU time available (we have a 3280 core cluster).
Another thing to note is that most machine learning techniques are fairly generic. So, usually there is already a perfectly fine C/C++ implementation available. Sometimes with bindings and all.
In this case, you're also guilty of putting optimization before the algorithm.
How do you know? Most data is actually preprocessed using Prolog or Perl. But the actual machine software is written in C or C++.
Speed is the last step, and often the only one which can be improved by throwing money at it.
Again, there are niches where it is worth it. And machine learning is often that niche, because people use huge data sets, complex problems, or both.
Besides which, if you want to have a pissing contest about speed, C is still going to lose to FPGAs.
Yes, but FPGAs are not readily available to our users :). But we are very much interested in GPU computing.
---
Apart from all of this, it's funny that you pointing to the price of implementing in ML software in C. It's not as if there are large amounts of Haskell programmers available. Writing such software in Haskell has about the same economic risk as using COBOL ;).