Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cauchy test 3 #190

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

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)
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.

None yet

3 participants