我有一个例子,我必须按顺序调用 predict 。在这种情况下,为什么 SVGP 预测会比 SGPR 更快?对于所有稀疏模型,预测的时间复杂度是否都相同,或者我错过了什么?这是我为测试它而运行的代码:
from numpy.random import randn
import gpflow
sgpr = gpflow.models.SGPR(X=randn(70000,8), Y=randn(70000,1), kern=gpflow.kernels.SquaredExponential(8), Z=randn(200,8))
sgpr.predict_y(randn(1,8))
%timeit -n 100 -r 7 sgpr.predict_y(randn(1,8))
>>> 128 ms ± 696 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
svgp = gpflow.models.SVGP(X=randn(70000,8), Y=randn(70000,1), kern=gpflow.kernels.SquaredExponential(8), likelihood=gpflow.likelihoods.Gaussian(), Z=randn(200,8))
svgp.predict_y(randn(1,8))
%timeit -n 100 -r 7 svgp.predict_y(randn(1,8))
>>> 6.61 ms ± 913 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)