-
Notifications
You must be signed in to change notification settings - Fork 57
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
Specify different measures, kernels and domains for n-dimensional integration using bayesquad #753
Comments
hey, could you let me know which version or commit of probnum you are using? The |
Just to make sure, I just re-tried It should be the latest version. |
OK, that should be the latest version then, that's great. You can check it also by running import probnum
probnum.__version__
>>> '0.1.22.dev10' Regarding your questions:
import numpy as np
from probnum.quad import bayesquad
from probnum.randprocs.kernels import ExpQuad
def fun(x):
return np.sum(x **2, axis=1)
input_dim = 2
rng = np.random.default_rng()
domain = (-3, 3) # if input_dim > 1, domain will be expanded to ([-3, -3, ...], [3, 3, ...])
kernel=ExpQuad(input_shape=(input_dim,))
bayesquad(
fun=fun,
input_dim=input_dim,
domain=domain,
kernel=kernel,
rng=rng,
)
input_dim = 2
rng = np.random.default_rng()
domain = ([-3, 0], [3, 1]) # Domain contains bounds ([lower_1, lower_2, ...], [upper_1, upper_2, ...])
kernel=ExpQuad(input_shape=(input_dim,))
bayesquad(
fun=fun,
input_dim=input_dim,
domain=domain,
kernel=kernel,
rng=rng,
)
from probnum.quad.integration_measures import LebesgueMeasure
input_dim = 2
rng = np.random.default_rng()
domain = ([-3, 0], [3, 1])
measure = LebesgueMeasure(input_dim=input_dim, domain=domain)
kernel=ExpQuad(input_shape=(input_dim,))
bayesquad(
fun=fun,
input_dim=input_dim,
measure=measure,
kernel=kernel,
rng=rng,
)
from probnum.quad.integration_measures import GaussianMeasure
input_dim = 2
rng = np.random.default_rng()
measure = GaussianMeasure(input_dim=input_dim, mean=0.0, cov=1.0)
kernel=ExpQuad(input_shape=(input_dim,))
bayesquad(
fun=fun,
input_dim=input_dim,
measure=measure,
kernel=kernel,
rng=rng,
) Please also note that input_dim = 2
rng = np.random.default_rng()
domain = ([-3, 0], [3, 1])
kernel=ExpQuad(input_shape=(input_dim,), lengthscale=0.3) # appropriate lengthscale
bayesquad(
fun=fun,
input_dim=input_dim,
domain=domain,
kernel=kernel,
rng=rng,
) Can you check if the code runs for you? And does that answer your questions? |
It works very well! Thanks a lot! I would assume that the hyper-parameters optimization feature is on the way, so this feature request is unnecessary. |
Glad to hear! Thanks for the quick feedback.
Yes, it's planned (a first step is this PR #581 ). It may still take a while though and I cannot promise a date unfortunately. |
Closing this issue as it seems resolved. @panweihit feel free to re-open, or open a new issue an case there are further questions. |
Hi,
I use the example in #512. I have two naive questions.
measure
andkernel
inprobnum
'sbayesquad
function. Did I make something wrong in the argument?domain
for the two inputs are bothCan I specify different domains, such as
Expect your reply. Thanks!
The text was updated successfully, but these errors were encountered: