Created
September 21, 2020 15:04
-
-
Save willtownes/42421f40a0c62fbcab7a18bd4d091a80 to your computer and use it in GitHub Desktop.
GPflow multioutput
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gpflow.conditionals import conditional | |
from gpflow.inducing_variables import SeparateIndependentInducingVariables | |
from gpflow.kernels import SeparateIndependent | |
#note: object 'm' is of type gpflow.models.svgp.SVGP | |
ind_conditional = conditional.dispatch( | |
object, SeparateIndependentInducingVariables, SeparateIndependent, object) | |
gmu, gvar = ind_conditional( | |
X, | |
m.inducing_variable, | |
m.kernel, | |
m.q_mu, | |
full_cov=False, | |
q_sqrt=m.q_sqrt, | |
full_output_cov=False, | |
white=False | |
) | |
# extract fitted parameters | |
Wfit = m.kernel.W.numpy() | |
fm,fv = m.predict_f(X) | |
fm = fm.numpy() | |
fm2 = gmu.numpy()@Wfit.T | |
np.max(np.abs(fm2-fm)) |
for others stumbling on this in the future, the solution was to change white=True
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Variable 'X' is just the training data