<jupyter_start><jupyter_text>Really mean example<jupyter_code>rbf2 = GPflow.sgpr.SGPR(X, Y, GPflow.kernels.RBF(1) + GPflow.kernels.RBF(1), X[:20, :].copy())
rbf2.kern.rbf_1.lengthscales = rbf.kern.lengthscales.value.copy()
rbf2.kern.rbf_2.lengthscales = rbf.kern.lengthscales.value.copy()
rbf2.kern.rbf_1.variance = rbf.kern.variance.value.copy() * 0.5
rbf2.kern.rbf_2.variance = rbf.kern.variance.value.copy() * 0.5
rbf2.kern.fixed = True
rbf2.likelihood.variance = 0.1
rbf2.optimize()
plot_model(rbf2)
sumrbflin_full = sumgp.FullSVSumGP(X, Y, rbf2.kern.rbf_1, rbf2.kern.rbf_2,
                                   GPflow.likelihoods.Gaussian(), rbf2.Z.value.copy(), rbf2.Z.value.copy())
sumrbflin_full.kern1.fixed = True
sumrbflin_full.kern2.fixed = True
sumrbflin_full.Z1.fixed = True
sumrbflin_full.Z2.fixed = True
sumrbflin_full.optimize()
plot_model(sumrbflin_full)
cov = np.dot(sumrbflin_full.q_sqrt.value[:, :, 0], sumrbflin_full.q_sqrt.value[:, :, 0].T)
plt.figure()
plt.imshow(cov)
plt.colorbar()
sumrbflin_mf = sumgp.MeanFieldSVSumGP(X, Y, rbf2.kern.rbf_1, rbf2.kern.rbf_2,
                                      GPflow.likelihoods.Gaussian(), rbf2.Z.value.copy(), rbf2.Z.value.copy())
sumrbflin_mf.kern1.fixed = True
sumrbflin_mf.kern2.fixed = True
sumrbflin_mf.Z1.fixed = True
sumrbflin_mf.Z2.fixed = True
sumrbflin_mf.optimize()
plot_model(sumrbflin_mf)
sumrbflin_mf.kern1.fixed = False
sumrbflin_mf.kern2.fixed = False
sumrbflin_mf.Z1.fixed = False
sumrbflin_mf.Z2.fixed = False
sumrbflin_mf.kern1.variance = sumrbflin_mf.kern1.variance.value + 0.001
sumrbflin_mf.optimize()
plot_model(sumrbflin_mf)
sumrbflin_mf.kern2<jupyter_output><empty_output><jupyter_text>Test for equality<jupyter_code>rbf3 = GPflow.sgpr.SGPR(X, Y, GPflow.kernels.RBF(1) + GPflow.kernels.RBF(1), X[:20, :].copy())
rbf3.kern.rbf_1.lengthscales = 2
rbf3.likelihood.variance = 0.1
rbf3.optimize()
plot_model(rbf3)
sumrbflin_mf = sumgp.MeanFieldSVSumGP(X, Y, rbf3.kern.rbf_1, rbf3.kern.rbf_2,
                                      GPflow.likelihoods.Gaussian(), rbf3.Z.value.copy(), rbf3.Z.value.copy())
sumrbflin_mf.kern1.fixed = True
sumrbflin_mf.kern2.fixed = True
sumrbflin_mf.Z1.fixed = True
sumrbflin_mf.Z2.fixed = True
sumrbflin_mf.optimize()
plot_model(sumrbflin_mf)
sumrbflin_full = sumgp.FullSVSumGP(X, Y, rbf3.kern.rbf_1, rbf3.kern.rbf_2,
                                   GPflow.likelihoods.Gaussian(), rbf3.Z.value.copy(), rbf3.Z.value.copy())
sumrbflin_full.q_mu = sumrbflin_mf.q_mu.value.T.flatten()[:, None]
mf_cov = np.zeros((2 * len(sumrbflin_mf.Z1.value), 2 * len(sumrbflin_mf.Z1.value)))
mf_cov[:20, :20] = sumrbflin_mf.q_sqrt.value[:, :, 0]
mf_cov[20:, 20:] = sumrbflin_mf.q_sqrt.value[:, :, 1]
sumrbflin_full.q_sqrt = mf_cov[:, :, None]
sumrbflin_full.likelihood = sumrbflin_mf.likelihood
sumrbflin_full._compile()
plot_model(sumrbflin_full)
sumrbflin_full.optimize()
plot_model(sumrbflin_full)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1485148514851485, 'fraction_numerical': 0.03379993171730966, 'mean_word_length': 4.591603053435114, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '146718', 'license': 'Apache-2.0', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1308, 'n_words': 148, 'path': 'notebooks/sum-gp.ipynb', 'repo_name': 'markvdw/convgp', 'size': '2929'}