Average Error: 0.5 → 0.6
Time: 22.9s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left({\left(e^{x}\right)}^{3} + {1}^{3}\right) - \left(\log \left(1 + e^{x} \cdot \left(e^{x} - 1\right)\right) + y \cdot x\right)\]
\log \left(1 + e^{x}\right) - x \cdot y
\log \left({\left(e^{x}\right)}^{3} + {1}^{3}\right) - \left(\log \left(1 + e^{x} \cdot \left(e^{x} - 1\right)\right) + y \cdot x\right)
double f(double x, double y) {
        double r5712622 = 1.0;
        double r5712623 = x;
        double r5712624 = exp(r5712623);
        double r5712625 = r5712622 + r5712624;
        double r5712626 = log(r5712625);
        double r5712627 = y;
        double r5712628 = r5712623 * r5712627;
        double r5712629 = r5712626 - r5712628;
        return r5712629;
}

double f(double x, double y) {
        double r5712630 = x;
        double r5712631 = exp(r5712630);
        double r5712632 = 3.0;
        double r5712633 = pow(r5712631, r5712632);
        double r5712634 = 1.0;
        double r5712635 = pow(r5712634, r5712632);
        double r5712636 = r5712633 + r5712635;
        double r5712637 = log(r5712636);
        double r5712638 = r5712631 - r5712634;
        double r5712639 = r5712631 * r5712638;
        double r5712640 = r5712634 + r5712639;
        double r5712641 = log(r5712640);
        double r5712642 = y;
        double r5712643 = r5712642 * r5712630;
        double r5712644 = r5712641 + r5712643;
        double r5712645 = r5712637 - r5712644;
        return r5712645;
}

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.6
\[\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.6

    \[\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.6

    \[\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. Applied associate--l-0.6

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

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

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

Reproduce

herbie shell --seed 2019134 
(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)))