{"action":"created","issue":{"url":"https://api.github.com/repos/SheffieldML/GPy/issues/65","labels_url":"https://api.github.com/repos/SheffieldML/GPy/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/SheffieldML/GPy/issues/65/comments","events_url":"https://api.github.com/repos/SheffieldML/GPy/issues/65/events","html_url":"https://github.com/SheffieldML/GPy/issues/65","id":15865748,"number":65,"title":"Deal with non-float inputs (for R-convolution kernels)","user":{"login":"beckdaniel","id":3418051,"avatar_url":"https://avatars.githubusercontent.com/u/3418051?v=3","gravatar_id":"","url":"https://api.github.com/users/beckdaniel","html_url":"https://github.com/beckdaniel","followers_url":"https://api.github.com/users/beckdaniel/followers","following_url":"https://api.github.com/users/beckdaniel/following{/other_user}","gists_url":"https://api.github.com/users/beckdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/beckdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beckdaniel/subscriptions","organizations_url":"https://api.github.com/users/beckdaniel/orgs","repos_url":"https://api.github.com/users/beckdaniel/repos","events_url":"https://api.github.com/users/beckdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/beckdaniel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2013-06-21T18:55:29Z","updated_at":"2015-09-12T14:36:49Z","closed_at":null,"body":"Hi all,\r\n\r\nI'm trying to implement R-convolution kernels (Haussler 1999) in GPy. These kernels are not defined on [R x R] but rather on sets of discrete structures. They don't expect a pair of reals (or real vectors) as input values but rather a pair of arbitrary structures (like strings, trees or graphs, for example) and measure the similarity between them.\r\n\r\nI'm having trouble implementing them because there is code which expects real values (or vectors) before actually applying the kernel. For example the predict function in gp.py normalize input values. However, there's no such normalization defined for strings or trees.\r\n\r\nI was able to run a toy version of Tree Kernels (Collins & Duffy 2001, a type of R-convolution kernels) by just commenting the normalization line in the predict function. However, it only works when I use it \"alone\", without combining it with other kernerls. My input data is composed of trees and also real vectors so my main goal is to use a kernel that combines (adds) a Tree Kernel (applied to the \"tree\" feature of my data) and a RBF Kernel (applied to the \"real vector\" features).\r\n\r\nIt's not possible to add the two kernels in the regular (non-tensor) way because they are defined on different sets. So, one possible solution would be to tensor add them (the resulting kernel would be defined on something like [R x Tree] x [R x Tree]). But the problem is that if I define a kernel this way, my input data cannot be represented as a regular Numpy array anymore.\r\n\r\nOne possible solution is to change the code so it can be able to cope with Numpy structured arrays. This is what I'm trying to do by now but I'm having a bit of a hard time having to adapt all the code (and it is quite hacky by now...). I noticed the \"input_slices\" parameter and I thought I could use it for splitting my input data into the \"tree\" part and \"real vector\" part but I'm not managing to have slices work with structured arrays.\r\n\r\nAnother point is that R-convolution kernels still output real values as result. So, in theory, you should not need to tensor add the kernels to define a big kernel on [R x Tree] x [R x Tree], but rather calculate the \"tree part\" on the [Tree x Tree] kernel, the \"real vector part\" on the [R x R] kernel and sum the results at the end. So, another solution would be to define a way to have \"multiple inputs\" (X vectors), one for each kernel part.\r\n\r\nI'm not sure which one is the best solution though. And any of them seems to require a big amount of change to the code base (maybe big enough to justify the decision to not implement them?)."},"comment":{"url":"https://api.github.com/repos/SheffieldML/GPy/issues/comments/139775365","html_url":"https://github.com/SheffieldML/GPy/issues/65#issuecomment-139775365","issue_url":"https://api.github.com/repos/SheffieldML/GPy/issues/65","id":139775365,"user":{"login":"beckdaniel","id":3418051,"avatar_url":"https://avatars.githubusercontent.com/u/3418051?v=3","gravatar_id":"","url":"https://api.github.com/users/beckdaniel","html_url":"https://github.com/beckdaniel","followers_url":"https://api.github.com/users/beckdaniel/followers","following_url":"https://api.github.com/users/beckdaniel/following{/other_user}","gists_url":"https://api.github.com/users/beckdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/beckdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beckdaniel/subscriptions","organizations_url":"https://api.github.com/users/beckdaniel/orgs","repos_url":"https://api.github.com/users/beckdaniel/repos","events_url":"https://api.github.com/users/beckdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/beckdaniel/received_events","type":"User","site_admin":false},"created_at":"2015-09-12T14:36:49Z","updated_at":"2015-09-12T14:36:49Z","body":"Ok, apparently there is a new master version. I will try to merge with my tree kernel branch and see what happens."}}