{"action":"created","issue":{"url":"https://api.github.com/repos/SheffieldML/GPy/issues/334","repository_url":"https://api.github.com/repos/SheffieldML/GPy","labels_url":"https://api.github.com/repos/SheffieldML/GPy/issues/334/labels{/name}","comments_url":"https://api.github.com/repos/SheffieldML/GPy/issues/334/comments","events_url":"https://api.github.com/repos/SheffieldML/GPy/issues/334/events","html_url":"https://github.com/SheffieldML/GPy/issues/334","id":140963552,"number":334,"title":"Kernel changes after predicting","user":{"login":"jluttine","id":2195834,"avatar_url":"https://avatars.githubusercontent.com/u/2195834?v=3","gravatar_id":"","url":"https://api.github.com/users/jluttine","html_url":"https://github.com/jluttine","followers_url":"https://api.github.com/users/jluttine/followers","following_url":"https://api.github.com/users/jluttine/following{/other_user}","gists_url":"https://api.github.com/users/jluttine/gists{/gist_id}","starred_url":"https://api.github.com/users/jluttine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jluttine/subscriptions","organizations_url":"https://api.github.com/users/jluttine/orgs","repos_url":"https://api.github.com/users/jluttine/repos","events_url":"https://api.github.com/users/jluttine/events{/privacy}","received_events_url":"https://api.github.com/users/jluttine/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SheffieldML/GPy/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/SheffieldML/GPy/milestones/6","html_url":"https://github.com/SheffieldML/GPy/milestones/GPy%201.0.0","labels_url":"https://api.github.com/repos/SheffieldML/GPy/milestones/6/labels","id":1592623,"number":6,"title":"GPy 1.0.0","description":"","creator":{"login":"mzwiessele","id":1563689,"avatar_url":"https://avatars.githubusercontent.com/u/1563689?v=3","gravatar_id":"","url":"https://api.github.com/users/mzwiessele","html_url":"https://github.com/mzwiessele","followers_url":"https://api.github.com/users/mzwiessele/followers","following_url":"https://api.github.com/users/mzwiessele/following{/other_user}","gists_url":"https://api.github.com/users/mzwiessele/gists{/gist_id}","starred_url":"https://api.github.com/users/mzwiessele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzwiessele/subscriptions","organizations_url":"https://api.github.com/users/mzwiessele/orgs","repos_url":"https://api.github.com/users/mzwiessele/repos","events_url":"https://api.github.com/users/mzwiessele/events{/privacy}","received_events_url":"https://api.github.com/users/mzwiessele/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":5,"state":"open","created_at":"2016-02-19T10:16:24Z","updated_at":"2016-03-15T14:00:20Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-03-15T12:52:41Z","updated_at":"2016-03-15T14:01:43Z","closed_at":null,"body":"I'm not sure if this is a bug, but at least I don't understand why this happens and it seems really weird. If I predict for a kernel that is a sum of (some of) the model's kernels, the model's kernel actually changes for some reason. Consider this example:\r\n\r\n```python\r\nkern1 = GPy.kern.RBF(input_dim=1, name='kern1')\r\nkern2 = GPy.kern.RBF(input_dim=1, name='kern2')\r\nkern3 = GPy.kern.RBF(input_dim=1, name='kern3')\r\nx = np.random.randn(100, 1)\r\ny = np.random.randn(100, 1)\r\nm = GPy.models.GPRegression(x, y, kernel=kern1+kern2+kern3)\r\n# No problem\r\nm.predict(x, kern=kern1+kern2)\r\ndisplay(m)\r\n# No problem\r\nm.predict(x, kern=m.kern.kern1)\r\ndisplay(m)\r\n# Problem (sum of kernels accessed via the model object)\r\nm.predict(x, kern=m.kern.kern1+m.kern.kern2)\r\ndisplay(m)\r\n```\r\n\r\nThe last display command shows that the model has dropped kernels kern1 and kern2. Why? How should I predict using a kernel that is a sum of some of the kernels?\r\n\r\nIt also seems that using `kern1`, `kern2`, `kern3`, instead of `m.kern.kern1`, `m.kern.kern2`, `m.kern.kern3` is not the correct way, because after an optimization `kern1` et al don't have the optimized parameter values. That is also slightly confusing (a bug?) but I thought the solution was to access the kernels via the model object. But now I'm a bit lost.\r\n\r\nAny ideas? Am I just doing something wrong here?"},"comment":{"url":"https://api.github.com/repos/SheffieldML/GPy/issues/comments/196834454","html_url":"https://github.com/SheffieldML/GPy/issues/334#issuecomment-196834454","issue_url":"https://api.github.com/repos/SheffieldML/GPy/issues/334","id":196834454,"user":{"login":"mzwiessele","id":1563689,"avatar_url":"https://avatars.githubusercontent.com/u/1563689?v=3","gravatar_id":"","url":"https://api.github.com/users/mzwiessele","html_url":"https://github.com/mzwiessele","followers_url":"https://api.github.com/users/mzwiessele/followers","following_url":"https://api.github.com/users/mzwiessele/following{/other_user}","gists_url":"https://api.github.com/users/mzwiessele/gists{/gist_id}","starred_url":"https://api.github.com/users/mzwiessele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzwiessele/subscriptions","organizations_url":"https://api.github.com/users/mzwiessele/orgs","repos_url":"https://api.github.com/users/mzwiessele/repos","events_url":"https://api.github.com/users/mzwiessele/events{/privacy}","received_events_url":"https://api.github.com/users/mzwiessele/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T14:01:43Z","updated_at":"2016-03-15T14:01:43Z","body":"Omg, yes that is a bug! \r\n\r\nThanks for spotting it, I will have a look.\r\n\r\nI think we will just have to make the reusability a little less. The current way was, that kernels, which went into the sum, were not copied, but we will have to copy them.\r\n\r\nYou are using it exactly how it was intended to be used, but we oversay this issue.\r\n\r\nThanks!"}}