{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaDiff/ReverseDiffSource.jl/issues/28","labels_url":"https://api.github.com/repos/JuliaDiff/ReverseDiffSource.jl/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/JuliaDiff/ReverseDiffSource.jl/issues/28/comments","events_url":"https://api.github.com/repos/JuliaDiff/ReverseDiffSource.jl/issues/28/events","html_url":"https://github.com/JuliaDiff/ReverseDiffSource.jl/issues/28","id":121862534,"number":28,"title":"Allowing extra (constant) arguments to differentiated function","user":{"login":"scidom","id":2519036,"avatar_url":"https://avatars.githubusercontent.com/u/2519036?v=3","gravatar_id":"","url":"https://api.github.com/users/scidom","html_url":"https://github.com/scidom","followers_url":"https://api.github.com/users/scidom/followers","following_url":"https://api.github.com/users/scidom/following{/other_user}","gists_url":"https://api.github.com/users/scidom/gists{/gist_id}","starred_url":"https://api.github.com/users/scidom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scidom/subscriptions","organizations_url":"https://api.github.com/users/scidom/orgs","repos_url":"https://api.github.com/users/scidom/repos","events_url":"https://api.github.com/users/scidom/events{/privacy}","received_events_url":"https://api.github.com/users/scidom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaDiff/ReverseDiffSource.jl/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-12T15:49:27Z","updated_at":"2015-12-16T13:12:43Z","closed_at":null,"body":"@fredo-dedup I started familiarizing myself with your package, and it is really great. I'd like to suggest a feature. For now, ReverseDiffSource works well with one argument:\r\n\r\n```\r\nusing ReverseDiffSource\r\n\r\nf(x::Vector) = x[1]^3+x[2]^2\r\n\r\ng = rdiff(f, ([1., 2.],))\r\n\r\ng([2., 2.])\r\n```\r\n\r\nThis is great but for Lora there is one more important use case. We may want to define a log-target `f` with more than one arguments. For example, we may want to define\r\n\r\n```\r\nf(x::Vector, y) = x[1]^3+x[2]^2+y\r\n```\r\n\r\nDifferentiation will happen with respect to the first input argument `x` of `f` only. Subsequent arguments to `f`, after the first one, will be ignored as far as autodiff goes. This way one may pass additional data to `f`, which is useful in case of hyper-parameters, data and Gibbs.\r\n\r\nWould it be possible to consider extending ReverseDiffSource this way? If this is possible, it would be nice to make this functionality available both for expressions and function input. to `rdiff()`."},"comment":{"url":"https://api.github.com/repos/JuliaDiff/ReverseDiffSource.jl/issues/comments/165100049","html_url":"https://github.com/JuliaDiff/ReverseDiffSource.jl/issues/28#issuecomment-165100049","issue_url":"https://api.github.com/repos/JuliaDiff/ReverseDiffSource.jl/issues/28","id":165100049,"user":{"login":"scidom","id":2519036,"avatar_url":"https://avatars.githubusercontent.com/u/2519036?v=3","gravatar_id":"","url":"https://api.github.com/users/scidom","html_url":"https://github.com/scidom","followers_url":"https://api.github.com/users/scidom/followers","following_url":"https://api.github.com/users/scidom/following{/other_user}","gists_url":"https://api.github.com/users/scidom/gists{/gist_id}","starred_url":"https://api.github.com/users/scidom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scidom/subscriptions","organizations_url":"https://api.github.com/users/scidom/orgs","repos_url":"https://api.github.com/users/scidom/repos","events_url":"https://api.github.com/users/scidom/events{/privacy}","received_events_url":"https://api.github.com/users/scidom/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T13:12:43Z","updated_at":"2015-12-16T13:12:43Z","body":"Thanks a lot @fredo-dedup. It will become a bit clearer how this can be interfaced with Lora in the next week or so, as I am working on changing slightly function signatures in parameter methods to take a single argument using closures; we would still need to ignore some parameters when doing the differentiation. I will be able to be a bit more concrete with examples in a few days, once I make the needed changes..."}}