zhaokg / Rbeast

Bayesian Change-Point Detection and Time Series Decomposition
208 stars 36 forks source link

Returning MCMC samples of trend/seasonality functions #24

Open wzhorton opened 4 months ago

wzhorton commented 4 months ago

Hi!

Is it possible to access the posterior samples of the trend and/or seasonality functions directly? Specifically, I'm interested in accessing the sampled vectors that ultimately get averaged together to form the Y outputs. If not, could this feature be added?

These would be helpful in order to look at posterior inferences for things like locations of positive slope, which Rbeast already provides, but also things like the locations of the local minima/maxima and the presence of particular shapes. Rather than open separate issues for each new inference that might come up, all would be handled if the user is given an option where those posterior samples could be returned directly, probably in the form of a matrix that is size N by n_iterations (assuming vector time-series input).

I recognize that returning posterior samples for ALL parameters is probably not feasible, but hopefully the trend/seasonality vector samples are easy enough structurally to add as an extra return item.

Thank you!

zhaokg commented 3 months ago

Hi there,

Thanks a lot your thoughtful and valuable input. (Sorry for not replying earlier.) Originally I had thought about providing an option to dump individual MCMC samples, but I ended not doing so, mostly because the output can be potentially huge. Instead, I just created a version with the gui argument, which gives a sloppy GUI window to show the sampling processes (it was implemented only for Windows not MacOS and Linux).

Another reason why I didn't implement it is because no other users request for that. If the raw samples are something of interest to you, I can take a stab at it and release it in the next version.

Again, thanks a lot for the input.

Kaiguang

wzhorton commented 3 months ago

Thanks for the reply! This is very interesting to me. I agree that size is cause for concern. My particular use case isn’t very big — I estimate about 5-10mb in memory needed for the trend curve samples — but I only used a few thousand samples for a few hundred datapoints. It’s easy to imagine how more data/samples could lead to heavy memory demands. But I’m not sure if there is a great solution other than a warning message, or maybe only returning the last N samples instead of all iterations.On Mar 8, 2024, at 8:35 PM, zhaokg @.***> wrote: Hi there, Thanks a lot your thoughtful and valuable input. (Sorry for not replying earlier.) Originally I had thought about providing an option to dump individual MCMC samples, but I ended not doing so, mostly because the output can be potentially huge. Instead, I just created a version with the gui argument, which gives a sloppy GUI window to show the sampling processes (it was implemented only for Windows not MacOS and Linux). Another reason why I didn't implement it is because no other users request for that. If the raw samples are something of interest to you, I can take a stab at it and release it in the next version. Again, thanks a lot for the input. Kaiguang

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>