On Monday, September 14, 2015 at 5:55:16 AM UTC-4, Michael Betancourt wrote:
> Well, it hasn’t been the most elegant process. Basically my proposing something
> to little response then my implementing it to everyone complaining about one thing
> or another with no constructive alternatives. Hence everything moving glacially.
Thanks for taking the time to sketch out where things are at, I appreciate it's frustrating to move something this big. I don't have much of an immediate response to this but it does help with reading the code. I do have two questions below.
> At the moment the writer is stuck in pull request limbo, and given that no one has
> picked up I’m going to have to put off the ODE stuff and do it this week. Because
> that’s all written and needs only be split up into a million pull requests, the only to
> do is to update the interfaces (other than CmdStan which is already ready in a
> branch).
Is the right CmdStan branch the update_to_write_callback or issue-151-remove-writer? It would probably help me understand what's going on if I have an example to go by on the interface side.
> Then there is the refactoring of the var_context. This will require lots of work
> but I need to get it into a working state first, which will require the writer be done
> to avoid some nasty merge conflicts. Once we start on this again there will be
> plenty to help with.
When you say "need to get [var_context] into a working state", does that mean that it's not in use? I thought I saw it in CmdStan and rstan interface code. Could you elaborate a little more about that bit?
> Once that’s done we have to figure out how to implement the new flat arguments
> (let’s all complain that we don’t like the current set up but not write a new one!),
> especially validation methods for the interfaces.
>
> Finally at that point we can implement a slew of new features blocked by the
> lack of a consistent API and then define an output file specification consistent
> with the API I/O routes. Given that spec we can write a robust csv_reader,
> and all kinds of fancy bits like streaming data formats and streaming estimators.
+1 for streaming I/O!
Anyway, thanks again for clarifying what's going on, it really helps to understand the C++ API and where it's going.
Krzysztof
>
> So the immediate to dos are sparse
> 1) Propagate the new writer callback through the VB code and get it to compile.
> 2) Wait for all of this to be merged into Stan and then help update the interfaces.
>
>
> > I'll have some time available on an ongoing basis over the next six months or so to do some Stan-related projects. One of the things I'm interested in is the input/output (reader/writer?) refactor but it's hard to figure out where the different pieces of it are at and how to contribute. I've already looked over the code under (https://github.com/stan-dev/stan/pull/1546) so I get what the overall goal is. Any suggestions about what the needs are for that branch at the moment?
That isn't why it's moving glacially. The reason most things get into the code base slowly is because pull requests are usually too big on construction, have problems, and are really not ready to go into the code as-is. There are plenty of pull requests that move quickly because they're easy to review, easy to verify, and they're ready to go (or close) when submitted.
Most proposals are fine, but proposals and implementation are different. When we start reviewing implementation, we actually look through and make sure it's not just correct but also something that can be maintained going forward.
+1 for streaming I/O!Ok, but there are deeper issues here. Right now, the var_context is immutable, so it's easy to think about the instantiated model class as really exposing a function:p(x, theta)where x is truly fixed and is data.We then take that instantiated model and do things assuming that this is true and that:p(theta | x) \propto p(x, theta)But... what happens when data is streaming and mutable? Then every call to p(x, theta) isn't really that what we thought it was.I have no problem with it, but I do think we need to make it clear when data is fixed and when data is not. We've always assumed in our code that data is fixed, but once we change that, we'll need to rethink how we handle var_contexts.
That isn't why it's moving glacially. The reason most things get into the code base slowly is because pull requests are usually too big on construction, have problems, and are really not ready to go into the code as-is. There are plenty of pull requests that move quickly because they're easy to review, easy to verify, and they're ready to go (or close) when submitted.The API is an f’ing mess right now. Nothing is going to be easy to review, and ifI’m submitting bad pull requests then how come literally no one else is workingon the API to make it better?
Most proposals are fine, but proposals and implementation are different. When we start reviewing implementation, we actually look through and make sure it's not just correct but also something that can be maintained going forward.Then you’re not reviewing the proposals well enough. If every change requires“write and then we’ll talk” then we’re going to waste a tremendous amount ofmanpower.
I would prefer to stream output to something else. My first thought for an alternative was a database keyed by sample/parameter. I get that write times could be an issue but for model complex models with model checking I end up with thousands of parameters so I really want something keyed that does not rely on R's memory management.
Krzysztof
Very wide .csv files take a long time to load into memory, they are unwieldy to maninpulate in R, they are difficult to read with csvkit (complicated header, adaptation data after column names), they are difficult to extract metadata from... if I load/subset, I have to reload each time I want a new subset of columns (also slow)... I think that's the main list.
> I
> don't understand "something keyed that doesn't rely on R".
>
> There's no way we're going to want to require a database to be
> set up to run Stan --- there are too many dependencies already.
> It could be optional in some way, which I guess R is OK with.
All Stan needs to do is hand over control over output by relying on callbacks. I could see two ways of doing it:
1) Create a Stan interface that relies on streaming everything (model, data, etc...) through protocol buffers (?) and provide the necessary callbacks as part of that interface. The result is another interface package, as independent of Stan/Math libraries as any other. A more reasonable goal might be to fork CmdStan just to experiment with how well streaming output to different databases works.
2) Make rstan's API (_NOT_ the regular interface) flexible enough to allow the programmer to pass in arbitrary callbacks. The result is another R package that's dependent on rstan.
I'm not saying either option is straightforward but with the current refactor I don't think it's outlandish either.
Krzysztof
>
> - Bob
Thanks for this, it'll take me a while to figure out what's going on but this helps a lot.
Krzysztof
One of the problems is that there aren't enough tests to make it easy to shift things around safely. So... if anyone wanted to move something, the thing that would help the most is to add tests to existing things.
Or do you mean streaming where you accumulate means and covariances?
It's not possible to compute streaming medians without storing at
least half of what would be in that .csv file in memory or somewhere.
95% intervals could be done storing 5% of the data in memory and so on
Agreed, and I did notice a few other people express interest. Once this part is done I want to contribute to (and maybe drive if nobody else does) having that happen. Krzysztof