内核的超参数;初始化和设置范围 [英] Kernel's hyper-parameters; initialization and setting bounds

查看:100
本文介绍了内核的超参数;初始化和设置范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为许多其他像我一样的人可能会对他们如何使用GPFlow解决特殊问题感兴趣.关键是GPFlow的可自定义方式,一个很好的例子将非常有帮助.

I think many other people like me might be interested in how they can use GPFlow for their special problems. The key is how GPFlow is customizable, and a good example would be very helpful.

就我而言,我在提出的问题上阅读并尝试了很多评论,但均未获得任何真正的成功.设置内核模型参数不是一件容易的事(使用默认值创建,然后通过delete object方法进行设置).转换方法含糊不清.

In my case, I read and tried lots of comments in raised issues without any real success. Setting kernel model parameters is not straightforward (creating with default values, and then do it via the delete object method). Transform method is vague.

如果您可以添加示例显示,那将非常有帮助.如何初始化和设置各向异性内核模型的边界(长度标度值和边界,方差等),并特别添加观察误差(作为数组形式的alpha参数)

It would be really helpful if you could add an example showing. how one can initialize and set bounds of an anisotropic kernel model (length-scales values and bounds, variances, ...) and specially adding observations error (as an array-like alpha parameter)

推荐答案

如果只想设置一个值,则可以

If you just want to set a value, then you can do

model = gpflow.models.GPR(np.zeros((1, 1)),
                          np.zeros((1, 1)),
                          gpflow.kernels.RBF(1, lengthscales=0.2))

或者

model = gpflow.models.GPR(np.zeros((1, 1)),
                          np.zeros((1, 1)),
                          gpflow.kernels.RBF(1))
model.kern.lengthscales = 0.2

如果要更改转换,则需要子类化内核,或者也可以这样做

If you want to change the transform, you either need to subclass the kernel, or you can also do

with gpflow.defer_build():
     model = gpflow.models.GPR(np.zeros((1, 1)),
                               np.zeros((1, 1)),
                               gpflow.kernels.RBF(1))
     transform = gpflow.transforms.Logistic(0.1, 1.))
     model.kern.lengthscales = gpflow.params.Parameter(0.3, transform=transform)
model.compile()

在更改变换之前,您需要 defer_build 来停止图形的编译.使用上述方法,张量流图的编译被延迟(直到显式的 model.compile()),因此使用预期的边界变换进行构建.

You need the defer_build to stop the graph being compiled before you've changed the transform. Using the approach above, the compilation of the tensorflow graph is delayed (until the explicit model.compile()) so is built with the intended bounding transform.

使用数组参数进行似然方差不在gpflow的范围内.对于它的价值(并且因为之前已经有人问过),该特定模型尤其成问题,因为尚不清楚如何定义测试点.

Using an array parameter for likelihood variance is outside the scope of gpflow. For what it's worth (and because it has been asked about before), that particular model is especially problematic as it is not clear how test points are defined.

这篇关于内核的超参数;初始化和设置范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆