\log \left(1 + e^{x}\right) - x \cdot y\log \left(1 + e^{x}\right) - y \cdot xdouble f(double x, double y) {
double r5182280 = 1.0;
double r5182281 = x;
double r5182282 = exp(r5182281);
double r5182283 = r5182280 + r5182282;
double r5182284 = log(r5182283);
double r5182285 = y;
double r5182286 = r5182281 * r5182285;
double r5182287 = r5182284 - r5182286;
return r5182287;
}
double f(double x, double y) {
double r5182288 = 1.0;
double r5182289 = x;
double r5182290 = exp(r5182289);
double r5182291 = r5182288 + r5182290;
double r5182292 = log(r5182291);
double r5182293 = y;
double r5182294 = r5182293 * r5182289;
double r5182295 = r5182292 - r5182294;
return r5182295;
}




Bits error versus x




Bits error versus y
Results
| Original | 0.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.5 |
Initial program 0.5
Final simplification0.5
herbie shell --seed 2019171
(FPCore (x y)
:name "Logistic regression 2"
:herbie-target
(if (<= x 0.0) (- (log (+ 1.0 (exp x))) (* x y)) (- (log (+ 1.0 (exp (- x)))) (* (- x) (- 1.0 y))))
(- (log (+ 1.0 (exp x))) (* x y)))