Average Error: 0.5 → 0.5
Time: 15.0s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left(1 + e^{x}\right) - y \cdot x\]
\log \left(1 + e^{x}\right) - x \cdot y
\log \left(1 + e^{x}\right) - y \cdot x
double f(double x, double y) {
        double r95906 = 1.0;
        double r95907 = x;
        double r95908 = exp(r95907);
        double r95909 = r95906 + r95908;
        double r95910 = log(r95909);
        double r95911 = y;
        double r95912 = r95907 * r95911;
        double r95913 = r95910 - r95912;
        return r95913;
}

double f(double x, double y) {
        double r95914 = 1.0;
        double r95915 = x;
        double r95916 = exp(r95915);
        double r95917 = r95914 + r95916;
        double r95918 = log(r95917);
        double r95919 = y;
        double r95920 = r95919 * r95915;
        double r95921 = r95918 - r95920;
        return r95921;
}

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.0
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;x \le 0.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. Simplified0.5

    \[\leadsto \color{blue}{\log \left(1 + e^{x}\right) - y \cdot x}\]
  3. Taylor expanded around inf 0.5

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

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

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

Reproduce

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