{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/math/issues/69","repository_url":"https://api.github.com/repos/stan-dev/math","labels_url":"https://api.github.com/repos/stan-dev/math/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/math/issues/69/comments","events_url":"https://api.github.com/repos/stan-dev/math/issues/69/events","html_url":"https://github.com/stan-dev/math/issues/69","id":93385599,"number":69,"title":"log_mix on the logit scale","user":{"login":"syclik","id":425751,"avatar_url":"https://avatars.githubusercontent.com/u/425751?v=3","gravatar_id":"","url":"https://api.github.com/users/syclik","html_url":"https://github.com/syclik","followers_url":"https://api.github.com/users/syclik/followers","following_url":"https://api.github.com/users/syclik/following{/other_user}","gists_url":"https://api.github.com/users/syclik/gists{/gist_id}","starred_url":"https://api.github.com/users/syclik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syclik/subscriptions","organizations_url":"https://api.github.com/users/syclik/orgs","repos_url":"https://api.github.com/users/syclik/repos","events_url":"https://api.github.com/users/syclik/events{/privacy}","received_events_url":"https://api.github.com/users/syclik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/stan-dev/math/labels/Feature","name":"Feature","color":"bfd4f2"},{"url":"https://api.github.com/repos/stan-dev/math/labels/new%20function","name":"new function","color":"bfe5bf"}],"state":"open","locked":false,"assignee":{"login":"rtrangucci","id":3925639,"avatar_url":"https://avatars.githubusercontent.com/u/3925639?v=3","gravatar_id":"","url":"https://api.github.com/users/rtrangucci","html_url":"https://github.com/rtrangucci","followers_url":"https://api.github.com/users/rtrangucci/followers","following_url":"https://api.github.com/users/rtrangucci/following{/other_user}","gists_url":"https://api.github.com/users/rtrangucci/gists{/gist_id}","starred_url":"https://api.github.com/users/rtrangucci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtrangucci/subscriptions","organizations_url":"https://api.github.com/users/rtrangucci/orgs","repos_url":"https://api.github.com/users/rtrangucci/repos","events_url":"https://api.github.com/users/rtrangucci/events{/privacy}","received_events_url":"https://api.github.com/users/rtrangucci/received_events","type":"User","site_admin":false},"assignees":[{"login":"rtrangucci","id":3925639,"avatar_url":"https://avatars.githubusercontent.com/u/3925639?v=3","gravatar_id":"","url":"https://api.github.com/users/rtrangucci","html_url":"https://github.com/rtrangucci","followers_url":"https://api.github.com/users/rtrangucci/followers","following_url":"https://api.github.com/users/rtrangucci/following{/other_user}","gists_url":"https://api.github.com/users/rtrangucci/gists{/gist_id}","starred_url":"https://api.github.com/users/rtrangucci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtrangucci/subscriptions","organizations_url":"https://api.github.com/users/rtrangucci/orgs","repos_url":"https://api.github.com/users/rtrangucci/repos","events_url":"https://api.github.com/users/rtrangucci/events{/privacy}","received_events_url":"https://api.github.com/users/rtrangucci/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2015-07-06T21:53:34Z","updated_at":"2016-08-15T15:29:14Z","closed_at":null,"body":"_From @bob-carpenter on February 3, 2015 18:31_\n\nNow that we have log_mix defined on the natural probability scale:\r\n\r\n```\r\nlog_mix(theta, lp1, lp2) \r\n  = log(theta * exp(lp1) + (1 - theta) * exp(lp2))\r\n  = log_sum_exp(log(theta * exp(lp1)), log((1 - theta) * exp(lp2))\r\n  = log_sum_exp(log(theta) + lp1, log(1-theta) + lp2)\r\n```\r\n\r\nit'd be nice to roll in the link function (inv_logit) and just work on the unconstrained log-odds scale with\r\n\r\n```\r\nlog_mix_logit(alpha, lp1, lp2) \r\n  = log_mix(inv_logit(alpha), lp1, lp2)\r\n  = log_sum_exp(log(inv_logit(alpha) + lp1, log(1 - inv_logit(theta)) + lp2)\r\n```\r\n\r\nSpecial functions `log_inv_logit` and `log1m_inv_logit` already exist.  \n\n_Copied from original issue: stan-dev/stan#1260_"},"comment":{"url":"https://api.github.com/repos/stan-dev/math/issues/comments/239833110","html_url":"https://github.com/stan-dev/math/issues/69#issuecomment-239833110","issue_url":"https://api.github.com/repos/stan-dev/math/issues/69","id":239833110,"user":{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars.githubusercontent.com/u/3383807?v=3","gravatar_id":"","url":"https://api.github.com/users/bob-carpenter","html_url":"https://github.com/bob-carpenter","followers_url":"https://api.github.com/users/bob-carpenter/followers","following_url":"https://api.github.com/users/bob-carpenter/following{/other_user}","gists_url":"https://api.github.com/users/bob-carpenter/gists{/gist_id}","starred_url":"https://api.github.com/users/bob-carpenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bob-carpenter/subscriptions","organizations_url":"https://api.github.com/users/bob-carpenter/orgs","repos_url":"https://api.github.com/users/bob-carpenter/repos","events_url":"https://api.github.com/users/bob-carpenter/events{/privacy}","received_events_url":"https://api.github.com/users/bob-carpenter/received_events","type":"User","site_admin":false},"created_at":"2016-08-15T15:29:14Z","updated_at":"2016-08-15T15:29:14Z","body":"inv_logit does have analytic gradients.\n\nBut the elementwise functions are *not* more efficient\nthan writing the loop by hand, just more convenient.  This\nis very counterintuitive to those who only use interpreted\nlanguages like R or Python, where loops are super slow.\n\nTo make the elementwise functions more efficient, we'd need\nspecial autodiff that cuts down on the number of virtual\nfunction calls by calculating all the adjoint updates in a single\nvirtual function call attached to the first variable during chaining.\nI think there are some examples of that.  That's non-trivial given\nthe way the elementwise functions are being defined now for containers.\n\n"}}
{"actor":{"display_login":"bob-carpenter"}}