{"action":"created","comment":{"url":"https://api.github.com/repos/stan-dev/stan/pulls/comments/94100018","pull_request_review_id":14630469,"id":94100018,"diff_hunk":"@@ -0,0 +1,112 @@\n+#ifndef STAN_SERVICES_EXPERIMENTAL_ADVI_FULLRANK_HPP\n+#define STAN_SERVICES_EXPERIMENTAL_ADVI_FULLRANK_HPP\n+\n+#include <stan/callbacks/interrupt.hpp>\n+#include <stan/callbacks/writer.hpp>\n+#include <stan/services/util/experimental_message.hpp>\n+#include <stan/services/util/initialize.hpp>\n+#include <stan/services/util/rng.hpp>\n+#include <stan/io/var_context.hpp>\n+#include <stan/variational/advi.hpp>\n+#include <boost/random/additive_combine.hpp>\n+#include <string>\n+#include <vector>\n+\n+namespace stan {\n+  namespace services {\n+    namespace experimental {\n+      namespace advi {\n+\n+        /**\n+         * Runs fullrank ADVI.\n+         *\n+         * @tparam Model A model implementation\n+         *\n+         * @param model Input model to test (with data already instantiated)\n+         * @param init var context for initialization\n+         * @param random_seed random seed for the pseudo random number generator\n+         * @param chain chain id to advance the pseudo random number generator\n+         * @param init_radius radius to initialize\n+         * @param grad_samples number of samples for Monte Carlo estimate of gradients\n+         * @param elbo_samples number of samples for Monte Carlo estimate of ELBO\n+         * @param max_iterations maximum number of iterations\n+         * @param tol_rel_obj convergence tolerance on the relative norm of the objective\n+         * @param eta stepsize scaling parameter for variational inference\n+         * @param adapt_engaged adaptation engaged?\n+         * @param adapt_iterations number of iterations for eta adaptation\n+         * @param eval_elbo evaluate ELBO every Nth iteration\n+         * @param output_samples number of posterior samples to draw and save\n+         * @param[out] interrupt interrupt callback to be called every iteration\n+         * @param[out] message_writer output for messages\n+         * @param[out] init_writer Writer callback for unconstrained inits\n+         * @param[out] parameter_writer output for parameter values\n+         * @param[out] diagnostic_writer output for diagnostic values\n+         * @return stan::services::error_codes::OK if successful\n+         */\n+        template <class Model>","path":"src/stan/services/experimental/advi/fullrank.hpp","position":46,"original_position":46,"commit_id":"800856ead5c7108304d3cf7d016d3341cf17a7f2","original_commit_id":"0327d322c0df5f356c9728192211468d086c57f6","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},"body":"Yes, I believe so. I don't think `prob_grad` has enough of the methods -- we've just tacked on additional methods through the generator instead of actually updating the appropriate base class. So yes, let's create an issue for that.","created_at":"2016-12-29T04:01:36Z","updated_at":"2016-12-29T04:01:36Z","html_url":"https://github.com/stan-dev/stan/pull/2004#discussion_r94100018","pull_request_url":"https://api.github.com/repos/stan-dev/stan/pulls/2004","_links":{"self":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/comments/94100018"},"html":{"href":"https://github.com/stan-dev/stan/pull/2004#discussion_r94100018"},"pull_request":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004"}}},"pull_request":{"url":"https://api.github.com/repos/stan-dev/stan/pulls/2004","id":80550773,"html_url":"https://github.com/stan-dev/stan/pull/2004","diff_url":"https://github.com/stan-dev/stan/pull/2004.diff","patch_url":"https://github.com/stan-dev/stan/pull/2004.patch","issue_url":"https://api.github.com/repos/stan-dev/stan/issues/2004","number":2004,"state":"open","locked":false,"title":"Stan refactor","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},"body":"#### Submisison Checklist\n- [x] Run unit tests: `./runTests.py src/test/unit`\n- [x] Run cpplint: `make cpplint`\n- [x] Declare copyright holder and open-source license: see below\n#### Summary\n\nThis pull request accomplishes two major things:\n1. In the `src/stan/services` folder (the `stan::services` namespace), we now have functions that should be called by the interfaces.\n2. Removes a lot of the old code.\n\nIt does this while maintaining all current behavior.\n#### Intended Effect\n\nThe intended effect is to make the downstream interfaces easier to implement and maintain.\n\nThe code is much cleaner. Each of the functions in `src/stan/services` excluding the `src/stan/services/util` folder are meant to be called by RStan, PyStan, and CmdStan. This will also make it much easier to deal with the upcoming template build issue we will have with the introduction of forward-mode and RHMC.\n#### How to Verify\n\n(I'm sorry -- the diff is large.)\n1. All tests should pass. (The upstream tests will fail due to CmdStan `develop` branch not having changes necessary, but I'll submit a pull request on the CmdStan branch.)\n2. Take a look at all the new functions in `src/stan/services`. I've covered all the use cases of CmdStan, PyStan, and RStan. See side effects below.\n3. There were a couple of additional utilities outside of `src/stan/services` that were added. Take a look.\n\nIf there are some oddly implemented things in there, most weird implementations are due to keeping the existing behavior intact. This way, we can roll these changes out with a minor release and keep moving forward.\n#### Side Effects\n\nCmdStan, RStan, and PyStan will break under the current branch, but will maintain the same behavior.\n\nI have a branch of CmdStan that works. Allen has a branch of PyStan that's almost working. I have a branch of RStan that's almost working.\n#### Documentation\n\nThe C++ code may need some more doc.\n\nIf anyone wants to help, there's that and adding more tests.\n#### Reviewer Suggestions\n\nThis one's big, so it'd be helpful to have a few eyes on it.\n\n@ariddell, @bgoodri: since this will effect both of you directly.\n@sakrejda: since you've been looking at this for a while.\n@bob-carpenter, @betanalpha, @rtrangucci: if you've got the time.\n\nAlthough I'm confident that this behaves identically, this one shouldn't be taken lightly.\n#### Copyright and Licensing\n\nPlease list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Columbia University\n\nBy submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:\n- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)\n- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)\n","created_at":"2016-08-09T02:05:25Z","updated_at":"2016-12-29T04:01:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33de9742c4613b5cc19e051b06bbcbffc35f6966","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/stan-dev/stan/milestones/25","html_url":"https://github.com/stan-dev/stan/milestone/25","labels_url":"https://api.github.com/repos/stan-dev/stan/milestones/25/labels","id":2215091,"number":25,"title":"v2.14.0++","description":"Next version after v2.14.0.","creator":{"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},"open_issues":46,"closed_issues":1,"state":"open","created_at":"2016-12-26T00:54:20Z","updated_at":"2016-12-26T20:55:36Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/stan-dev/stan/pulls/2004/commits","review_comments_url":"https://api.github.com/repos/stan-dev/stan/pulls/2004/comments","review_comment_url":"https://api.github.com/repos/stan-dev/stan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stan-dev/stan/issues/2004/comments","statuses_url":"https://api.github.com/repos/stan-dev/stan/statuses/800856ead5c7108304d3cf7d016d3341cf17a7f2","head":{"label":"stan-dev:feature/issue-1751-service-methods","ref":"feature/issue-1751-service-methods","sha":"800856ead5c7108304d3cf7d016d3341cf17a7f2","user":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":8043756,"name":"stan","full_name":"stan-dev/stan","owner":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stan-dev/stan","description":"Stan development repository (home page is linked below). The master branch contains the current release. The develop branch contains the latest stable development.  See the Developer Process Wiki for details.  ","fork":false,"url":"https://api.github.com/repos/stan-dev/stan","forks_url":"https://api.github.com/repos/stan-dev/stan/forks","keys_url":"https://api.github.com/repos/stan-dev/stan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stan-dev/stan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stan-dev/stan/teams","hooks_url":"https://api.github.com/repos/stan-dev/stan/hooks","issue_events_url":"https://api.github.com/repos/stan-dev/stan/issues/events{/number}","events_url":"https://api.github.com/repos/stan-dev/stan/events","assignees_url":"https://api.github.com/repos/stan-dev/stan/assignees{/user}","branches_url":"https://api.github.com/repos/stan-dev/stan/branches{/branch}","tags_url":"https://api.github.com/repos/stan-dev/stan/tags","blobs_url":"https://api.github.com/repos/stan-dev/stan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stan-dev/stan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stan-dev/stan/git/refs{/sha}","trees_url":"https://api.github.com/repos/stan-dev/stan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stan-dev/stan/statuses/{sha}","languages_url":"https://api.github.com/repos/stan-dev/stan/languages","stargazers_url":"https://api.github.com/repos/stan-dev/stan/stargazers","contributors_url":"https://api.github.com/repos/stan-dev/stan/contributors","subscribers_url":"https://api.github.com/repos/stan-dev/stan/subscribers","subscription_url":"https://api.github.com/repos/stan-dev/stan/subscription","commits_url":"https://api.github.com/repos/stan-dev/stan/commits{/sha}","git_commits_url":"https://api.github.com/repos/stan-dev/stan/git/commits{/sha}","comments_url":"https://api.github.com/repos/stan-dev/stan/comments{/number}","issue_comment_url":"https://api.github.com/repos/stan-dev/stan/issues/comments{/number}","contents_url":"https://api.github.com/repos/stan-dev/stan/contents/{+path}","compare_url":"https://api.github.com/repos/stan-dev/stan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stan-dev/stan/merges","archive_url":"https://api.github.com/repos/stan-dev/stan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stan-dev/stan/downloads","issues_url":"https://api.github.com/repos/stan-dev/stan/issues{/number}","pulls_url":"https://api.github.com/repos/stan-dev/stan/pulls{/number}","milestones_url":"https://api.github.com/repos/stan-dev/stan/milestones{/number}","notifications_url":"https://api.github.com/repos/stan-dev/stan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stan-dev/stan/labels{/name}","releases_url":"https://api.github.com/repos/stan-dev/stan/releases{/id}","deployments_url":"https://api.github.com/repos/stan-dev/stan/deployments","created_at":"2013-02-06T03:25:04Z","updated_at":"2016-12-29T03:58:56Z","pushed_at":"2016-12-28T16:23:12Z","git_url":"git://github.com/stan-dev/stan.git","ssh_url":"git@github.com:stan-dev/stan.git","clone_url":"https://github.com/stan-dev/stan.git","svn_url":"https://github.com/stan-dev/stan","homepage":"http://mc-stan.org","size":248705,"stargazers_count":738,"watchers_count":738,"language":"Stan","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":149,"forks":155,"open_issues":149,"watchers":738,"default_branch":"develop"}},"base":{"label":"stan-dev:develop","ref":"develop","sha":"578e02e9e2ee85d589f1eb5d1cbf50c3e6255128","user":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":8043756,"name":"stan","full_name":"stan-dev/stan","owner":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stan-dev/stan","description":"Stan development repository (home page is linked below). The master branch contains the current release. The develop branch contains the latest stable development.  See the Developer Process Wiki for details.  ","fork":false,"url":"https://api.github.com/repos/stan-dev/stan","forks_url":"https://api.github.com/repos/stan-dev/stan/forks","keys_url":"https://api.github.com/repos/stan-dev/stan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stan-dev/stan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stan-dev/stan/teams","hooks_url":"https://api.github.com/repos/stan-dev/stan/hooks","issue_events_url":"https://api.github.com/repos/stan-dev/stan/issues/events{/number}","events_url":"https://api.github.com/repos/stan-dev/stan/events","assignees_url":"https://api.github.com/repos/stan-dev/stan/assignees{/user}","branches_url":"https://api.github.com/repos/stan-dev/stan/branches{/branch}","tags_url":"https://api.github.com/repos/stan-dev/stan/tags","blobs_url":"https://api.github.com/repos/stan-dev/stan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stan-dev/stan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stan-dev/stan/git/refs{/sha}","trees_url":"https://api.github.com/repos/stan-dev/stan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stan-dev/stan/statuses/{sha}","languages_url":"https://api.github.com/repos/stan-dev/stan/languages","stargazers_url":"https://api.github.com/repos/stan-dev/stan/stargazers","contributors_url":"https://api.github.com/repos/stan-dev/stan/contributors","subscribers_url":"https://api.github.com/repos/stan-dev/stan/subscribers","subscription_url":"https://api.github.com/repos/stan-dev/stan/subscription","commits_url":"https://api.github.com/repos/stan-dev/stan/commits{/sha}","git_commits_url":"https://api.github.com/repos/stan-dev/stan/git/commits{/sha}","comments_url":"https://api.github.com/repos/stan-dev/stan/comments{/number}","issue_comment_url":"https://api.github.com/repos/stan-dev/stan/issues/comments{/number}","contents_url":"https://api.github.com/repos/stan-dev/stan/contents/{+path}","compare_url":"https://api.github.com/repos/stan-dev/stan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stan-dev/stan/merges","archive_url":"https://api.github.com/repos/stan-dev/stan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stan-dev/stan/downloads","issues_url":"https://api.github.com/repos/stan-dev/stan/issues{/number}","pulls_url":"https://api.github.com/repos/stan-dev/stan/pulls{/number}","milestones_url":"https://api.github.com/repos/stan-dev/stan/milestones{/number}","notifications_url":"https://api.github.com/repos/stan-dev/stan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stan-dev/stan/labels{/name}","releases_url":"https://api.github.com/repos/stan-dev/stan/releases{/id}","deployments_url":"https://api.github.com/repos/stan-dev/stan/deployments","created_at":"2013-02-06T03:25:04Z","updated_at":"2016-12-29T03:58:56Z","pushed_at":"2016-12-28T16:23:12Z","git_url":"git://github.com/stan-dev/stan.git","ssh_url":"git@github.com:stan-dev/stan.git","clone_url":"https://github.com/stan-dev/stan.git","svn_url":"https://github.com/stan-dev/stan","homepage":"http://mc-stan.org","size":248705,"stargazers_count":738,"watchers_count":738,"language":"Stan","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":149,"forks":155,"open_issues":149,"watchers":738,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004"},"html":{"href":"https://github.com/stan-dev/stan/pull/2004"},"issue":{"href":"https://api.github.com/repos/stan-dev/stan/issues/2004"},"comments":{"href":"https://api.github.com/repos/stan-dev/stan/issues/2004/comments"},"review_comments":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004/comments"},"review_comment":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004/commits"},"statuses":{"href":"https://api.github.com/repos/stan-dev/stan/statuses/800856ead5c7108304d3cf7d016d3341cf17a7f2"}}}}
{"actor":{"display_login":"syclik"}}