Skip to content

Conversation

@staplejw
Copy link
Contributor

Failure in: 6:RoundTrip:7:3:t_cauchy_reciprocal_transformation:0
haskell/Tests/TestTools.hs:130
expected:
stdNormal = p <~ normal(nat2real(0), nat2prob(1))
return p
stdCauchy = X1 <~ stdNormal
X2 <~ stdNormal
return X1 / X2
cauchy = fn a real:
fn alpha prob:
X <~ stdCauchy
return a + prob2real(alpha) * X
X <~ cauchy(nat2real(0), 1/2)
return X
but got:
p5 <~ normal(+0/1, 1/1)
p3 <~ normal(+0/1, 1/1)
return p5 / p3 * (+1/2)
Cases: 338 Tried: 293 Errors: 2 Failures: 26

Failure in: 6:RoundTrip:7:3:t_cauchy_reciprocal_transformation:1
haskell/Tests/TestTools.hs:130
expected:
stdNormal = p <~ normal(nat2real(0), nat2prob(1))
return p
stdCauchy = X1 <~ stdNormal
X2 <~ stdNormal
return X1 / X2
cauchy = fn a real:
fn alpha prob:
X <~ stdCauchy
return a + prob2real(alpha) * X
X <~ cauchy(nat2real(0), 1/2)
return X
but got:
p5 <~ normal(+0/1, 1/1)
p3 <~ normal(+0/1, 1/1)
return 1/ p5 * p3 * (+1/2)
Cases: 338 Tried: 294 Errors: 2 Failures: 27
Cases: 338 Tried: 295 Errors: 2 Failures: 27
Cases: 338 Tried: 296 Errors: 2 Failures: 27
Cases: 338 Tried: 297 Errors: 2 Failures: 27

@staplejw staplejw changed the title adding test for cauchy reciprocal transformation Cauchy test 3 Apr 19, 2018
@mkhattab940
Copy link
Contributor

Done in-lining. Failure looks like this now

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

#cauchy(0,1/2)
X1 <~ normal(+0/1, 1/1)
X2 <~ normal(+0/1, 1/1)
return X1/X2*(+1/2) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if you rewrite this as 1/X2*X1*(+1/2) then your test will pass.

@mkhattab940
Copy link
Contributor

OK fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants