8 ms·
How useful is this when you are using numbers in a reasonable range, like 10^-12 to 10^12? Generally I try to scale my numbers to be in this range, whether by p
by fluorinerocket 6mo ago
How useful is this when you are using numbers in a reasonable range, like 10^-12 to 10^12?
Generally I try to scale my numbers to be in this range, whether by picking the right units or scaling constraints and objectives when doing nonlinear programming/ optimization.
Like looking at this example,
https://herbie.uwplse.org/demo/b070b371a661191752fe37ce0321c3e813691aa6.0cc3b6492c83efca5bd11399e0830e7873c749d9/graph.html https://herbie.uwplse.org/demo/b070b371a661191752fe37ce0321c...
It is claimed that for the function f(x) =sqrt(x+1) -1
Accuracy is increased by from 8.5%
accuracy to 98% for alternative 5
Which has f(x) = 0.5x
Ok so x=99, the right answer is sqrt(100) -1 = 9
But 0.5 * 99 = 49.5 which doesn't seem too accurate to me.
- hmpc 6mo agoCheck the specification at the top. The range for x is [-1, 1]. For the range you provided the accuracy of the 0.5x alternative is reported as only 33%: https://herbie.uwplse.org/demo/570b973df0f1f4a78fe791858038a84f635de8c6.0cc3b6492c83efca5bd11399e0830e7873c749d9/graph.html https://herbie.uwplse.org/demo/570b973df0f1f4a78fe791858038a...
- fluorinerocket 6mo agoYou're right I misread the graph. That said though I have played around with Herbie before, trying it out on a few of the more gnarly expressions I had in my code (analytical partial derivatives if equations of motion if launch vehicle in rotating spherical frame) and didn't see much appreciable improvement over the expected range of values, but then again I didn't check every single one. What would be cool is if you could some how have this kind of analysis done automatically for your whole program where it finds the needle in the haystack expression that can be improved, assuming you gave expected ranges for your variables
- pavpanchekha 6mo agoAuthor here. I've got a few papers about this problem (including one in submission), but it is very very hard to do, especially with acceptable overhead. The state of the art is maybe 100x overhead.
- yossi_peti 6mo agoThe precondition on the link you shared has -1 <= x && x <= 1, so 99 is way outside of that range. But even so, testing for x=1, which is supposed to be inside that range, 0.5 doesn't seem tolerably close to 0.4142.
- LiamPowell 6mo agoI have a suspicion that the accuracy number is the mean of accuracies over all valid floats in the range (or something approximating that), which is going to be weighted towards zero where the accuracy is higher, and perhaps where sqrt near 1 has some artefacts.
- pavpanchekha 6mo agoIt is, there's a page in the documentation about how errors are defined. Let me also add: Herbie generally gives the most accurate option it found first, and then the other stuff might be useful for speed (0.5x is way faster than two square roots and a divide!) but it's not as accurate
- Rexxar 6mo agoThe input should be the range and the distribution of probability on this range. Intuitively we have a tendency to assume an uniform probability for range [-1, 1] which is not the case if we check every doubles.
- fluorinerocket 6mo agoYou're right but still, big error. I get its averaging over the range, and the floats are not uniformly distributed. Maybe the thing to optimize the expression for is the minimize the maximum error, and not the average error. I think that's what I would care about