Closed charstnut closed 1 year ago
Hi Charles,
Thank you for asking! I hope our package is helpful to you.
You can sample from the learned variables. To do this, in the second run of MCIntegration.integrate
, you need to set the argument var = result.config.var
, where result
is the return value of the previous integrate call. I demonstrate the idea in the following figure. You can see the second run starts with much less noise.
If there are multiple types of variables and you only need one of them, you can pick that one from result.config.var
, then use it to build a new set of variables for your new integral.
You can also access the learned distribution of the i-th variable using result.config.var[i].histogram
. We don't have a built-in function to output it yet.
It is definitely a good idea to give an example in the tutorial on how to reuse the learned variables.
Best, Kun
Hi Kun,
Thank you for the prompt answer! Is the following output reasonable for the demo problem? I am plotting the learned histogram but it seems to be uniform.
using MCIntegration
res = integrate((x, c) -> log(x[1]) / sqrt(x[1]))
plot(res.config.var[1].histogram)
Hi Charles,
My bad.
The variable Continuous
finds the optimal grid so that the measured histogram is as flat as possible. So you should plot result.config.var[1].grid
instead. The following figure is generated from plot(result.config.var[1].grid)
, the x-axis is the index of the optimized grid, and the y-axis is the actual grid point.
BTW: Right now, the result.config.var[1].histogram
is set to ~0 after the integration. That's why you find it is all 10^-10. We probably should keep the histogram information in the next release.
best, Kun
Hi Kun,
Perfect! Thanks a lot. With the grid information I should be able to convert it to a sampler with interpolation.
Best, Charles
Hi,
Thanks for making this library for integration. I'm wondering if it's possible to sample from the learned variables (in the
Configuration
) directly? This would be helpful to evaluate other quantities that depend on the variable distribution after the integration and optimization is done. It would also be helpful to output the pdf of the optimized variables.Best, Charles