hakaru icon indicating copy to clipboard operation
hakaru copied to clipboard

Laplace to ChiSq Test

Open mkhattab940 opened this issue 7 years ago • 2 comments

This one slipped through the cracks. Here's the failure:

### Failure in: 0:RoundTrip:0:3:t_laplace_to_stdChiSq:0
haskell/Tests/TestTools.hs:130
expected:
q <~ plate _ of 2: normal(+0/1, 1/1)
return real2prob(summate i from 0 to size(q): q[i] ^ 2)
but got:
q307 <~ normal(+0/1, 1/1)
q315 <~ normal(+0/1, 1/1)
return real2prob(q307 ^ 2 + q315 ^ 2)
Cases: 8  Tried: 7  Errors: 0  Failures: 6
                                          
### Failure in: 0:RoundTrip:0:3:t_laplace_to_stdChiSq:1
haskell/Tests/TestTools.hs:130
expected:
q <~ plate _ of 2: normal(+0/1, 1/1)
return real2prob(summate i from 0 to size(q): q[i] ^ 2)
but got:
X5 <~ gamma(1/1, 1/1)
Y3 <~ gamma(1/1, 1/1)
return abs(prob2real(X5) + prob2real(Y3) * (-1/1) + (-1/1)) * (2/1)
Cases: 8  Tried: 8  Errors: 0  Failures: 7

mkhattab940 avatar Apr 24 '18 00:04 mkhattab940

The expected is wrong here, at least for failure 0, the 'got' is indeed what I expected.

Failure 1 is weird - I don't understand how a plate of normals becomes two gammas when inlining.

JacquesCarette avatar Apr 24 '18 02:04 JacquesCarette

OK, fixed the 0-test. Failure looks like this now:

### Failure in: 6:RoundTrip:0:6:t_laplace_to_stdChiSq:1
haskell/Tests/TestTools.hs:130
expected:
X1 <~ normal(+0/1, 1/1)
X2 <~ normal(+0/1, 1/1)
return real2prob(X1 ^ 2 + X2 ^ 2)
but got:
X5 <~ gamma(1/1, 1/1)
Y3 <~ gamma(1/1, 1/1)
return abs(prob2real(X5) + prob2real(Y3) * (-1/1) + (-1/1)) * (2/1)
Cases: 172  Tried: 97  Errors: 0  Failures: 11
Cases: 172  Tried: 98  Errors: 0  Failures: 11

mkhattab940 avatar Apr 24 '18 03:04 mkhattab940