Average Error: 0.5 → 0.5
Time: 10.5s
Precision: 64
Internal Precision: 128
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left(1 + e^{x}\right) - y \cdot x\]

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. Final simplification0.5

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

Reproduce

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

Details

Time bar (total: 9.6s)Debug log

sample167.0ms

Algorithm
intervals

simplify12.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize24.0ms

Local error

Found 3 expressions with local error:

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

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
3 → 41
Calls

3 calls. Slowest were:

4.0ms
(- (log (+ 1 (exp x))) (* x y))
1.0ms
(log (+ 1 (exp x)))
1.0ms
(+ 1 (exp x))

series127.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

72.0ms
(log (+ 1 (exp x)))
44.0ms
(- (log (+ 1 (exp x))) (* x y))
11.0ms
(+ 1 (exp x))

simplify241.0ms

Counts
21 → 50
Calls

21 calls. Slowest were:

53.0ms
(+ (log 2) (+ (* 1/2 x) (* 1/8 (pow x 2))))
52.0ms
(+ (log 2) (+ (* 1/2 x) (* 1/8 (pow x 2))))
38.0ms
(+ x (+ (* 1/2 (pow x 2)) 2))

prune503.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize34.0ms

Local error

Found 3 expressions with local error:

5.6b
(log (+ x (+ (* 1/2 (pow x 2)) 2)))
0.0b
(- (log (+ x (+ (* 1/2 (pow x 2)) 2))) (* x y))
0.0b
(+ x (+ (* 1/2 (pow x 2)) 2))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

10.0ms
(- (log (+ x (+ (* 1/2 (pow x 2)) 2))) (* x y))
4.0ms
(+ x (+ (* 1/2 (pow x 2)) 2))
3.0ms
(log (+ x (+ (* 1/2 (pow x 2)) 2)))

series100.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

52.0ms
(- (log (+ x (+ (* 1/2 (pow x 2)) 2))) (* x y))
39.0ms
(log (+ x (+ (* 1/2 (pow x 2)) 2)))
9.0ms
(+ x (+ (* 1/2 (pow x 2)) 2))

simplify1.9s

Counts
21 → 51
Calls

21 calls. Slowest were:

262.0ms
(- (+ (log 1/2) (+ (* 2 (/ 1 (pow x 2))) (* 2 (/ 1 x)))) (* 2 (log (/ 1 x))))
256.0ms
(- (+ (log 1/2) (* 2 (/ 1 x))) (+ (* 2 (log (/ 1 x))) (* x y)))
227.0ms
(- (+ (log 1/2) (+ (* 2 (/ 1 (pow x 2))) (* 2 (/ 1 x)))) (* 2 (log (/ -1 x))))

prune531.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize10.0ms

Local error

Found 4 expressions with local error:

1.4b
(log (exp (- (log (+ 1 (exp x))) (* x y))))
0.0b
(exp (- (log (+ 1 (exp x))) (* x y)))
0.0b
(log (+ 1 (exp x)))
0.0b
(+ 1 (exp x))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 63
Calls

4 calls. Slowest were:

17.0ms
(log (exp (- (log (+ 1 (exp x))) (* x y))))
15.0ms
(exp (- (log (+ 1 (exp x))) (* x y)))
1.0ms
(log (+ 1 (exp x)))

series112.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

46.0ms
(log (+ 1 (exp x)))
36.0ms
(log (exp (- (log (+ 1 (exp x))) (* x y))))
23.0ms
(exp (- (log (+ 1 (exp x))) (* x y)))
6.0ms
(+ 1 (exp x))

simplify422.0ms

Counts
42 → 75
Calls

42 calls. Slowest were:

49.0ms
(+ (log 2) (+ (* 1/2 x) (* 1/8 (pow x 2))))
46.0ms
(exp (- (log (+ (exp x) 1)) (* x y)))
44.0ms
(+ (log 2) (+ (* 1/2 x) (* 1/8 (pow x 2))))

prune898.0ms

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes147.0ms

Accuracy

0% (0.2b remaining)

Error of 0.5b against oracle of 0.2b and baseline of 0.5b

bsearch2.0ms

end0.0ms

sample4.3s

Algorithm
intervals