hakaru icon indicating copy to clipboard operation
hakaru copied to clipboard

Cauchy test 4

Open staplejw opened this issue 7 years ago • 4 comments

Failure in: 6:RoundTrip:7:0:t_cauchy_to_students_t:0

haskell/Tests/TestTools.hs:130 expected: chiSq_iid = fn n nat: fn mean real: fn stdev prob: q <~ plate _ of n: normal(mean, stdev) return summate i from 0 to size(q): ((q[i] - mean) * prob2real(1/ stdev)) ^ 2 standardChiSq = fn n nat: chiSq_iid(n, nat2real(0), nat2prob(1)) standardChi = fn n nat: q <~ standardChiSq(n) return sqrt(real2prob(q)) nonCentralT = fn n nat: fn delta prob: U <~ normal(nat2real(0), nat2prob(1)) X <~ standardChi(n) return (U + prob2real(delta)) * prob2real(sqrt(nat2prob(n))) * prob2real(1/ X) t = fn n nat: nonCentralT(n, nat2prob(0)) t(1) but got: U7 <~ normal(+0/1, 1/1) q305 <~ normal(+0/1, 1/1) return U7 * prob2real(1/ abs(q305)) Cases: 342 Tried: 293 Errors: 2 Failures: 25

Failure in: 6:RoundTrip:7:0:t_cauchy_to_students_t:1

haskell/Tests/TestTools.hs:130 expected: chiSq_iid = fn n nat: fn mean real: fn stdev prob: q <~ plate _ of n: normal(mean, stdev) return summate i from 0 to size(q): ((q[i] - mean) * prob2real(1/ stdev)) ^ 2 standardChiSq = fn n nat: chiSq_iid(n, nat2real(0), nat2prob(1)) standardChi = fn n nat: q <~ standardChiSq(n) return sqrt(real2prob(q)) nonCentralT = fn n nat: fn delta prob: U <~ normal(nat2real(0), nat2prob(1)) X <~ standardChi(n) return (U + prob2real(delta)) * prob2real(sqrt(nat2prob(n))) * prob2real(1/ X) t = fn n nat: nonCentralT(n, nat2prob(0)) t(1) but got: p5 <~ normal(+0/1, 1/1) p3 <~ normal(+0/1, 1/1) return p5 / p3 Cases: 342 Tried: 294 Errors: 2 Failures: 26

staplejw avatar Apr 20 '18 22:04 staplejw

Done in-lining. Test now fails like this:

### Failure in: 6:RoundTrip:0:2:t_cauchy_to_students_t:1
haskell/Tests/TestTools.hs:130
expected:
U <~ normal(+0/1, 1/1)
X <~ normal(+0/1, 1/1)
return U * prob2real(1/ abs(X))
but got:
p5 <~ normal(+0/1, 1/1)
p3 <~ normal(+0/1, 1/1)
return p5 / p3
Cases: 164  Tried: 89  Errors: 0  Failures: 5
Cases: 164  Tried: 90  Errors: 0  Failures: 5

mkhattab940 avatar Apr 24 '18 05:04 mkhattab940

Hmmm, why does your expected have an 'abs' but the result doesn't? That is very puzzling.

JacquesCarette avatar Apr 24 '18 16:04 JacquesCarette

I've looked at the question you ask (i.e. what the test is) -- it is your 'expected' which is wrong. What you 'got' is correct.

JacquesCarette avatar Apr 24 '18 16:04 JacquesCarette

Ok fixed

mkhattab940 avatar Apr 24 '18 17:04 mkhattab940