Skip to content

Commit

Permalink
Added test for gmm_gibbs; expected program file is incorrect, but has…
Browse files Browse the repository at this point in the history
… other errors that might be worth looking at
  • Loading branch information
GenevaS committed Aug 1, 2017
1 parent d008c6e commit c3dbaf0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion haskell/Tests/RoundTrip.hs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ testOther :: Test
testOther = test [
"t82" ~: testConcreteFiles "tests/RoundTrip/t82.0.hk" "tests/RoundTrip/t82.expected.hk",
"testRoadmapProg1" ~: testConcreteFile "tests/RoundTrip/testRoadmapProg1.hk",
"testKernel" ~: testConcreteFiles "tests/RoundTrip/testKernel.0.hk" "tests/RoundTrip/testKernel.expected.hk"
"testKernel" ~: testConcreteFiles "tests/RoundTrip/testKernel.0.hk" "tests/RoundTrip/testKernel.expected.hk",
"gmm_gibbs" ~: testConcreteFiles "tests/RoundTrip/gmm_gibbs.0.hk" "tests/RoundTrip/gmm_gibbs.expected.hk"
--"testFalseDetection" ~: testStriv (lam seismicFalseDetection),
--"testTrueDetection" ~: testStriv (lam2 seismicTrueDetection)
--"testTrueDetectionL" ~: testStriv tdl,
Expand Down

4 comments on commit c3dbaf0

@GenevaS
Copy link
Contributor Author

@GenevaS GenevaS commented on c3dbaf0 Aug 1, 2017

Choose a reason for hiding this comment

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

@yuriy0 The Maple error is a little different in this context:

### Error in:   6:RoundTrip:6:3:gmm_gibbs:0
    MapleException:
    Error, (in sdmp:-mul) time expired

    after sending to Maple:
    use Hakaru, NewSLO in timelimit(90, RoundTrip(lam(`as`, HArray(HReal(Bound(`>=`,0))), lam(`z`, HArray(HInt(Bound(`>=`,0))), lam(`t`, HArray(HReal()), lam(`docUpdate`, HInt(Bound(`>=`,0)), case(And((size(`z`) = size(`t`)), `docUpdate` < size(`z`)), Branches(Branch(PDatum(true, PInl(PDone)), Msum(Weight(((2 ^ ((size(`as`) * 1/(2)) + (size(`t`) * (-1/2)))) * (Pi ^ (size(`t`) * (-1/2))) * exp((Sum((idx(`t`, `_a910`) ^ 2), `_a910`=0..(size(`t`))-1) * (-1/2))) * Product(Product(((`j` + idx(`as`, `_a`)) * 1/(Product((`_a` + Sum(idx(`as`, `_a910`), `_a910`=0..(size(`as`))-1)), `_a`=0..(Sum(case((`_a910` = `docUpdate`), Branches(Branch(PDatum(true, PInl(PDone)), 0), Branch(PDatum(false, PInr(PInl(PDone))), case(idx(`z`, `_a910`) < 0, Branches(Branch(PDatum(true, PInl(PDone)), 0), Branch(PDatum(false, PInr(PInl(PDone))), 1)))))), `_a910`=0..(size(`t`))-1))-1))), `j`=0..(Sum(case((`_a910` = `docUpdate`), Branches(Branch(PDatum(true, PInl(PDone)), 0), Branch(PDatum(false, PInr(PInl(PDone))), case((`_a` = idx(`z`, `_a910`)), Branches(Branch(PDatum(true, PInl(PDone)), 1), Branch(PDatum(false, PInr(PInl(PDone))), 0)))))), `_a910`=0..(size(`t`))-1))-1), `_a`=0..(size(`as`))-1)), Categorical(ary(size(`as`), `zNew6`, (exp((Sum(((Sum(case((`_a910` = case((`i` = `docUpdate`), Branches(Branch(PDatum(true, PInl(PDone)), `zNew6`), Branch(PDatum(false, PInr(PInl(PDone))), idx(`z`, `i`))))), Branches(Branch(PDatum(true, PInl(PDone)), idx(`t`, `i`)), Branch(PDatum(false, PInr(PInl(PDone))), 0))), `i`=0..(size(`t`))-1) ^ 2) * 1/((1 + Sum(case((`_a910` = case((`i` = `docUpdate`), Branches(Branch(PDatum(true, PInl(PDone)), `zNew6`), Branch(PDatum(false, PInr(PInl(PDone))), idx(`z`, `i`))))), Branches(Branch(PDatum(true, PInl(PDone)), 1), Branch(PDatum(false, PInr(PInl(PDone))), 0))), `i`=0..(size(`t`))-1)))), `_a910`=0..(size(`as`))-1) * 1/(2))) * 1/(root(Product((2 + (Sum(case((`_a` = case((`_a910` = `docUpdate`), Branches(Branch(PDatum(true, PInl(PDone)), `zNew6`), Branch(PDatum(false, PInr(PInl(PDone))), idx(`z`, `_a910`))))), Branches(Branch(PDatum(true, PInl(PDone)), 1), Branch(PDatum(false, PInr(PInl(PDone))), 0))), `_a910`=0..(size(`t`))-1) * 2)), `_a`=0..(size(`as`))-1), 2)) * (Sum(case((`_a910` = `docUpdate`), Branches(Branch(PDatum(true, PInl(PDone)), 0), Branch(PDatum(false, PInr(PInl(PDone))), case((`zNew6` = idx(`z`, `_a910`)), Branches(Branch(PDatum(true, PInl(PDone)), 1), Branch(PDatum(false, PInr(PInl(PDone))), 0)))))), `_a910`=0..(size(`t`))-1) + idx(`as`, `zNew6`)) * 1/((Sum(case((`_a910` = `docUpdate`), Branches(Branch(PDatum(true, PInl(PDone)), 0), Branch(PDatum(false, PInr(PInl(PDone))), case(idx(`z`, `_a910`) < 0, Branches(Branch(PDatum(true, PInl(PDone)), 0), Branch(PDatum(false, PInr(PInl(PDone))), 1)))))), `_a910`=0..(size(`t`))-1) + Sum(idx(`as`, `_a910`), `_a910`=0..(size(`as`))-1))))))))), Branch(PDatum(false, PInr(PInl(PDone))), Msum()))))))), HFunction(HArray(HReal(Bound(`>=`,0))), HFunction(HArray(HInt(Bound(`>=`,0))), HFunction(HArray(HReal()), HFunction(HInt(Bound(`>=`,0)), HMeasure(HInt(Bound(`>=`,0))))))), _command=Simplify)) end use;
### Error in:   6:RoundTrip:6:3:gmm_gibbs:1
    haskell\Language\Hakaru\Pretty\Maple.hs:(173,1)-(228,35): Non-exhaustive patterns in function mapleSCon

@ccshan
Copy link
Member

@ccshan ccshan commented on c3dbaf0 Aug 1, 2017

Choose a reason for hiding this comment

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

The timelimit I used at https://list.indiana.edu/sympa/arc/ppaml-l/2017-08/msg00001.html is 300 seconds, because indeed gmm_gibbs.hk takes a long time to simplify.

@yuriy0
Copy link

@yuriy0 yuriy0 commented on c3dbaf0 Aug 14, 2017

Choose a reason for hiding this comment

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

There were multiple issues here; the biggest one is that the simplified gmm_gibbs doesn't simplify again (it produces an infinite loop in Maple).

I haven't been able to track that down. A simple fix is to merge the transforms_as_syntax branch soon, and express a test cases which doesn't require simplifying the simplified program again.

@yuriy0
Copy link

@yuriy0 yuriy0 commented on c3dbaf0 Aug 15, 2017

Choose a reason for hiding this comment

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

express a test cases which doesn't require simplifying the simplified program again.

I've made this change on the transforms_as_syntax branch, and there are no more errors/infinite loops. Once that is merged, this will be fixed on master as well.

Please sign in to comment.