-
Notifications
You must be signed in to change notification settings - Fork 30
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
Trying to understand the testing frame work #169
Comments
Hello @maymoo99 ! So I don't see anything wrong with what the tests are doing. Simplify will inline function calls, which is basically what it did. You can check this behavior by calling simplify on
As you might know the maple code has no knowledge of chi^2, only simple distributions like normal, uniform, etc. So when code is emitted it will use the sum of two normals. So test 0 seems fine to me. I don't fully understand where test 1 comes from and need to dig in further. Generally you should trace this behavior to Summarize is not necessarily a more powerful version of Simplify. Summarize rewrites programs looking for every particular looping structure in the code. Simplify is actually trying to rewrite code to find closed forms for different distributions. Their roles are different. A common pattern is to call Simplify followed by Summarize. I hope that helps for now, and I'll add more comments as I get a better idea what's going on. |
One of the key pieces of information (for me!) in the above is that our tests are run twice, once with Simplify and once with Summarize -- I did not know this. That would indeed explain quite a few symptoms. At least, if that is indeed what is going on... Hmm, except that I can't see anything in |
OK, so here's something interesting:
Comparing this with the logs, it looks like this is how RoundTrip test cases run: 0:
1:
So, it's not Summarize, but Simplify being run to produce the 'but got' code. Now I'm really confused because the documentation clearly states that Simplify is |
@zaxtax To clarify, it's not so much that we think that there is something wrong with the tests so much as we are trying to understand how they are meant to work. My end goal for this discussion is to refine our hypothesis (in italics above) and to be able to speak accurately about our results in the paper we're writing. Why does the expected file have to pass the 0-test? What exactly are we testing here? What does it imply about the implementation if it passes? What might it imply about the implementation if it doesn't? It seems the 0-test has to pass if the 1-test has a chance of passing. When the 0-test fails, in general it seems like the "but got" result gets further simplified than the expected result. Why not reverse the roles of the expected/got algorithms in the 0-test and then the 1-test could compare the outputs of If I could think of the 1-test as running the same Simplification algorithm on both files (since, for 0-tests that pass, the 1-test will produce the same result using either algorithm on my expected file) it becomes immediately obvious how we're using the 1-test to test relationships between distributions. But why should 2 different optimization algorithms run on 2 different Hakaru programs produce the same result when the distributions they implement are equivalent? The story seems to be more complicated than just "if we can simplify both models to the same model, then Hakaru recognizes the relationship" which is essentially the level of nuance we are able to discuss our results at the moment. I hope these questions can be answered while keeping the discussion relatively high-level. |
@zaxtax @JacquesCarette bump |
I looked at the code, and I can't figure out where the whole 0-tests versus 1-tests comes from. Perhaphs @ccshan knows? |
I have an inkling. I think expected and got are both being passed to
Simplify. I haven't traced where but that's what I'm investigating.
…On Thu, Apr 19, 2018, 17:58 Jacques Carette ***@***.***> wrote:
I looked at the code, and I can't figure out where the whole 0-tests
versus 1-tests comes from. Perhaphs @ccshan <https://github.com/ccshan>
knows?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#169 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAhUcHSl2GTM8TtVh7paRAlRMWiMp5Gks5tqMJOgaJpZM4TU63O>
.
|
I'm still trying to trace the code. Was my hunch that both programs are being passed to Simplify correct? |
Hi @zaxtax
My team and I have been doing working on Hakaru for our undergrad capstone project. We are wrapping things up and writing a paper based on our results. However, we've been having trouble formulating our hypothesis.
We've been writing a number of RoundTrip test cases to test known relationships between distributions. However, we are having trouble understanding what exactly is going on with these tests. We've tried diving into the related files, but none of us are knowledgeable enough with Haskell to figure it out. Best we can tell is it grabs the test cases and passes them to some Maple environment.
@JacquesCarette has told us to ask you to explain it to us.
I'll explain what we've figured out so far and then hopefully you can fill in the gaps for us. So for example, we have added a test with the following result:
So for each test case it looks like 2 tests are run. I've messed around with
hk-maple
a bit and it looks like this is roughly what is happening:However, these outputs don't always exactly match the outputs when I run Summarize on these files (although they are very close) so I don't think this is exactly what is happening. Can you clarify how these outputs are generated?
We would also like to make sure we understand the purposes of both tests. The 0-test seems to be some sort preliminary test before the 1-test tests the actual relationship we are interested in. As far as I can tell, Summarize seems to be a more ambitious version of Simplify. So I expect if their outputs are equal, Summarize can't do any better, right? I think Dr. Carette had said it has to do with making sure some sort of change of variables is done correctly. Can you expand on this?
I know the 1 test is meant to produce equivalent code for Hakaru files describing equivalent distributions. Can you explain how the inference algorithms used in the test are meant to accomplish this?
For reference, this is the hypothesis we are currently working with:
Assume we know a relationship between 2 statistical distributions which transforms distribution A into distribution B, which we are able to prove by analyzing their PDFs.
We hypothesize that by applying the appropriate transformations on an implementation of distribution A in hakaru, we can create a hakaru program whose hk-maple output will be a hakaru program that is equivalent to the hakaru program output by hk-maple run on an implementation of distribution B.
Really appreciate your help with this.
The text was updated successfully, but these errors were encountered: