我想使用高斯过程回归执行一些多变量回归,如使用版本 2 在 GPflow 中实现的那样。安装 pip install gpflow==2.0.0rc1
下面是一些示例代码,它生成一些 2D 数据,然后尝试使用 GPR 对其进行拟合,最后计算真实输入数据和 GPR 预测之间的差异。
最终,我想扩展到更高的维度,并针对验证集进行测试以检查是否过拟合并使用其他内核和“自动相关性确定”进行试验,但了解如何使其工作是第一步。
谢谢!
以下代码片段将在 jupyter notebook 中工作。
import gpflow
import numpy as np
import matplotlib
from gpflow.utilities import print_summary
%matplotlib inline
matplotlib.rcParams['figure.figsize'] = (12, 6)
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def gen_data(X, Y):
"""
make some fake data.
X, Y are np.ndarrays with shape (N,) where
N is the number of samples.
"""
ys = []
for x0, x1 in zip(X,Y):
y = …Run Code Online (Sandbox Code Playgroud) gpflow ×1