Average Error: 0.5 → 0.5
Time: 15.2s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\log \left(e^{3 \cdot x} + 1\right) - \log \left(e^{x} \cdot e^{x} - \left(-1 + e^{x}\right)\right)\right) - x \cdot y\]
\log \left(1 + e^{x}\right) - x \cdot y
\left(\log \left(e^{3 \cdot x} + 1\right) - \log \left(e^{x} \cdot e^{x} - \left(-1 + e^{x}\right)\right)\right) - x \cdot y
double f(double x, double y) {
        double r5781257 = 1.0;
        double r5781258 = x;
        double r5781259 = exp(r5781258);
        double r5781260 = r5781257 + r5781259;
        double r5781261 = log(r5781260);
        double r5781262 = y;
        double r5781263 = r5781258 * r5781262;
        double r5781264 = r5781261 - r5781263;
        return r5781264;
}

double f(double x, double y) {
        double r5781265 = 3.0;
        double r5781266 = x;
        double r5781267 = r5781265 * r5781266;
        double r5781268 = exp(r5781267);
        double r5781269 = 1.0;
        double r5781270 = r5781268 + r5781269;
        double r5781271 = log(r5781270);
        double r5781272 = exp(r5781266);
        double r5781273 = r5781272 * r5781272;
        double r5781274 = -1.0;
        double r5781275 = r5781274 + r5781272;
        double r5781276 = r5781273 - r5781275;
        double r5781277 = log(r5781276);
        double r5781278 = r5781271 - r5781277;
        double r5781279 = y;
        double r5781280 = r5781266 * r5781279;
        double r5781281 = r5781278 - r5781280;
        return r5781281;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.5
Target0.1
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;x \le 0:\\ \;\;\;\;\log \left(1 + e^{x}\right) - x \cdot y\\ \mathbf{else}:\\ \;\;\;\;\log \left(1 + e^{-x}\right) - \left(-x\right) \cdot \left(1 - y\right)\\ \end{array}\]

Derivation

  1. Initial program 0.5

    \[\log \left(1 + e^{x}\right) - x \cdot y\]
  2. Using strategy rm
  3. Applied flip3-+0.5

    \[\leadsto \log \color{blue}{\left(\frac{{1}^{3} + {\left(e^{x}\right)}^{3}}{1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)}\right)} - x \cdot y\]
  4. Applied log-div0.5

    \[\leadsto \color{blue}{\left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right)\right)} - x \cdot y\]
  5. Simplified0.5

    \[\leadsto \left(\color{blue}{\log \left(e^{3 \cdot x} + 1\right)} - \log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right)\right) - x \cdot y\]
  6. Simplified0.5

    \[\leadsto \left(\log \left(e^{3 \cdot x} + 1\right) - \color{blue}{\log \left(e^{x} \cdot e^{x} - \left(-1 + e^{x}\right)\right)}\right) - x \cdot y\]
  7. Final simplification0.5

    \[\leadsto \left(\log \left(e^{3 \cdot x} + 1\right) - \log \left(e^{x} \cdot e^{x} - \left(-1 + e^{x}\right)\right)\right) - x \cdot y\]

Reproduce

herbie shell --seed 2019149 
(FPCore (x y)
  :name "Logistic regression 2"

  :herbie-target
  (if (<= x 0) (- (log (+ 1 (exp x))) (* x y)) (- (log (+ 1 (exp (- x)))) (* (- x) (- 1 y))))

  (- (log (+ 1 (exp x))) (* x y)))