学习博士提到高斯过程的RBF核具有各向同性变量和各向异性变量。这是非常清楚什么是各向同性变体,因为这是高斯过程的“基本”版本,在介绍性文本。然而,各向异性变量的实现并不明显。在拉斯穆森的文本中传递时提到了几个选项(第89页)。有人知道在sklearn模块sklearn.gaussian_process.kernels.RBF中实现哪个版本吗?
发布于 2020-04-08 18:55:16
这个答案有点晚了,但它仍然可能对你或其他人有帮助。如果您仔细查看\sklearn\gaussian_process\kernel.py中的RBF类,您将发现以下描述:
Parameters
----------
length_scale : float or array with shape (n_features,), default: 1.0
The length scale of the kernel. If a float, an isotropic kernel is
used. If an array, an anisotropic kernel is used where each dimension
of l defines the length-scale of the respective feature dimension.
length_scale_bounds : pair of floats >= 0, default: (1e-5, 1e5)
The lower and upper bound on length_scale因此,我的假设是,您需要传递一个“与输入x的维数相同”的length_scale数组(参见scikit高斯过程)。
为了更准确地回答实现各向异性的哪个变量的问题,我的建议(不需要进一步检查代码)是以下列方式操作欧氏距离(参见拉斯穆森):
r^2(x, x') = (x - x').T * M * (x - x'),其中M是一个对角线矩阵,对应于每个方向的长度标度(实际上是1/l^2) (相对于你的坐标系)。
https://stackoverflow.com/questions/50066580
复制相似问题