Average Error: 0.5 → 0.5
Time: 19.3s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left(\frac{1 \cdot \left(1 \cdot 1\right) + e^{3 \cdot x}}{1 \cdot 1 + \left(e^{x} - 1\right) \cdot e^{x}}\right) - y \cdot x\]
\log \left(1 + e^{x}\right) - x \cdot y
\log \left(\frac{1 \cdot \left(1 \cdot 1\right) + e^{3 \cdot x}}{1 \cdot 1 + \left(e^{x} - 1\right) \cdot e^{x}}\right) - y \cdot x
double f(double x, double y) {
        double r5628971 = 1.0;
        double r5628972 = x;
        double r5628973 = exp(r5628972);
        double r5628974 = r5628971 + r5628973;
        double r5628975 = log(r5628974);
        double r5628976 = y;
        double r5628977 = r5628972 * r5628976;
        double r5628978 = r5628975 - r5628977;
        return r5628978;
}

double f(double x, double y) {
        double r5628979 = 1.0;
        double r5628980 = r5628979 * r5628979;
        double r5628981 = r5628979 * r5628980;
        double r5628982 = 3.0;
        double r5628983 = x;
        double r5628984 = r5628982 * r5628983;
        double r5628985 = exp(r5628984);
        double r5628986 = r5628981 + r5628985;
        double r5628987 = exp(r5628983);
        double r5628988 = r5628987 - r5628979;
        double r5628989 = r5628988 * r5628987;
        double r5628990 = r5628980 + r5628989;
        double r5628991 = r5628986 / r5628990;
        double r5628992 = log(r5628991);
        double r5628993 = y;
        double r5628994 = r5628993 * r5628983;
        double r5628995 = r5628992 - r5628994;
        return r5628995;
}

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. 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. Simplified0.5

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

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

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

Reproduce

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