{"action":"created","comment":{"url":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/comments/158336431","pull_request_review_id":85132974,"id":158336431,"diff_hunk":"@@ -21,3 +21,43 @@ inverse_interpolation <- function (x, y, ypred, omega) {\n     return(xpred)\n }\n \n+\n+#' Local inverse interpolation with bandwidth selected via k-fold cross-validation.\n+#'\n+#' @param x The matrix of \"training\" values of x, with one row per training set.\n+#' @param y The matrix of \"training\" values of y corresponding to x.\n+#' @param ypred The matrix of \"test\" values of y for which a value of x will be predicted.\n+#' @param seed The random seed used in the k-fold cross-validation.\n+#' @param min_omega The minimum bandwidth attempted. \n+#' @param max_omega The initial maximum bandwidth attempted. \n+#' @param k The number of folds to use in cross-validation.\n+#' @export\n+#' @return List of `omega_min`, the omega that minimizes the cross-validation error,\n+#'                 `ypred` the matrix of predicted x values for the optimal\n+#'                 omega, with dimensions (nrow(ypred), ncol(x)), and\n+#'                 `boundary_value` a boolean indicating if `omega_min` is on\n+#'                 the boundary of the range of omegas examined.\n+automatic_inverse_interpolation <- function (x, y, ypred, seed, min_omega, max_omega=NA, k=5) {\n+    max_omega <- 50 * min_omega\n+    omegas <- seq(min_omega, max_omega, length.out=100)\n+    idxs <- 1:length(x)","path":"R/inverse_interpolation.R","position":31,"original_position":31,"commit_id":"bde16e495ff9ae8b0220433189918eeb56b37a13","original_commit_id":"bde16e495ff9ae8b0220433189918eeb56b37a13","user":{"login":"petrelharp","id":1046249,"avatar_url":"https://avatars2.githubusercontent.com/u/1046249?v=4","gravatar_id":"","url":"https://api.github.com/users/petrelharp","html_url":"https://github.com/petrelharp","followers_url":"https://api.github.com/users/petrelharp/followers","following_url":"https://api.github.com/users/petrelharp/following{/other_user}","gists_url":"https://api.github.com/users/petrelharp/gists{/gist_id}","starred_url":"https://api.github.com/users/petrelharp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrelharp/subscriptions","organizations_url":"https://api.github.com/users/petrelharp/orgs","repos_url":"https://api.github.com/users/petrelharp/repos","events_url":"https://api.github.com/users/petrelharp/events{/privacy}","received_events_url":"https://api.github.com/users/petrelharp/received_events","type":"User","site_admin":false},"body":"recall that `x` is/should be a matrix: you want here\r\n```\r\nidxs <- 1:NROW(x)\r\n```","created_at":"2017-12-21T17:39:30Z","updated_at":"2017-12-21T17:39:30Z","html_url":"https://github.com/petrelharp/interpolation_methods/pull/3#discussion_r158336431","pull_request_url":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/comments/158336431"},"html":{"href":"https://github.com/petrelharp/interpolation_methods/pull/3#discussion_r158336431"},"pull_request":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3","id":159597320,"html_url":"https://github.com/petrelharp/interpolation_methods/pull/3","diff_url":"https://github.com/petrelharp/interpolation_methods/pull/3.diff","patch_url":"https://github.com/petrelharp/interpolation_methods/pull/3.patch","issue_url":"https://api.github.com/repos/petrelharp/interpolation_methods/issues/3","number":3,"state":"open","locked":false,"title":"Add automated selection of bandwidth via CV","user":{"login":"ashander","id":510776,"avatar_url":"https://avatars2.githubusercontent.com/u/510776?v=4","gravatar_id":"","url":"https://api.github.com/users/ashander","html_url":"https://github.com/ashander","followers_url":"https://api.github.com/users/ashander/followers","following_url":"https://api.github.com/users/ashander/following{/other_user}","gists_url":"https://api.github.com/users/ashander/gists{/gist_id}","starred_url":"https://api.github.com/users/ashander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashander/subscriptions","organizations_url":"https://api.github.com/users/ashander/orgs","repos_url":"https://api.github.com/users/ashander/repos","events_url":"https://api.github.com/users/ashander/events{/privacy}","received_events_url":"https://api.github.com/users/ashander/received_events","type":"User","site_admin":false},"body":"This additional function uses k-fold cross-validation to select the best value\nfor bandwidth, omega. Its return provides information if the best bandwidth was\nset on the boundary of the values examined.\n\nNote b/c the vignette workflow was not documented I also have changed the\nlocation to work with `devtools::build_vignettes()`","created_at":"2017-12-21T08:07:33Z","updated_at":"2017-12-21T17:39:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62fdebb1388453c83292474299c0bfea06596f41","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3/commits","review_comments_url":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3/comments","review_comment_url":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/comments{/number}","comments_url":"https://api.github.com/repos/petrelharp/interpolation_methods/issues/3/comments","statuses_url":"https://api.github.com/repos/petrelharp/interpolation_methods/statuses/bde16e495ff9ae8b0220433189918eeb56b37a13","head":{"label":"ashander:add-cv","ref":"add-cv","sha":"bde16e495ff9ae8b0220433189918eeb56b37a13","user":{"login":"ashander","id":510776,"avatar_url":"https://avatars2.githubusercontent.com/u/510776?v=4","gravatar_id":"","url":"https://api.github.com/users/ashander","html_url":"https://github.com/ashander","followers_url":"https://api.github.com/users/ashander/followers","following_url":"https://api.github.com/users/ashander/following{/other_user}","gists_url":"https://api.github.com/users/ashander/gists{/gist_id}","starred_url":"https://api.github.com/users/ashander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashander/subscriptions","organizations_url":"https://api.github.com/users/ashander/orgs","repos_url":"https://api.github.com/users/ashander/repos","events_url":"https://api.github.com/users/ashander/events{/privacy}","received_events_url":"https://api.github.com/users/ashander/received_events","type":"User","site_admin":false},"repo":{"id":114935336,"name":"interpolation_methods","full_name":"ashander/interpolation_methods","owner":{"login":"ashander","id":510776,"avatar_url":"https://avatars2.githubusercontent.com/u/510776?v=4","gravatar_id":"","url":"https://api.github.com/users/ashander","html_url":"https://github.com/ashander","followers_url":"https://api.github.com/users/ashander/followers","following_url":"https://api.github.com/users/ashander/following{/other_user}","gists_url":"https://api.github.com/users/ashander/gists{/gist_id}","starred_url":"https://api.github.com/users/ashander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashander/subscriptions","organizations_url":"https://api.github.com/users/ashander/orgs","repos_url":"https://api.github.com/users/ashander/repos","events_url":"https://api.github.com/users/ashander/events{/privacy}","received_events_url":"https://api.github.com/users/ashander/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ashander/interpolation_methods","description":null,"fork":true,"url":"https://api.github.com/repos/ashander/interpolation_methods","forks_url":"https://api.github.com/repos/ashander/interpolation_methods/forks","keys_url":"https://api.github.com/repos/ashander/interpolation_methods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ashander/interpolation_methods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ashander/interpolation_methods/teams","hooks_url":"https://api.github.com/repos/ashander/interpolation_methods/hooks","issue_events_url":"https://api.github.com/repos/ashander/interpolation_methods/issues/events{/number}","events_url":"https://api.github.com/repos/ashander/interpolation_methods/events","assignees_url":"https://api.github.com/repos/ashander/interpolation_methods/assignees{/user}","branches_url":"https://api.github.com/repos/ashander/interpolation_methods/branches{/branch}","tags_url":"https://api.github.com/repos/ashander/interpolation_methods/tags","blobs_url":"https://api.github.com/repos/ashander/interpolation_methods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ashander/interpolation_methods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ashander/interpolation_methods/git/refs{/sha}","trees_url":"https://api.github.com/repos/ashander/interpolation_methods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ashander/interpolation_methods/statuses/{sha}","languages_url":"https://api.github.com/repos/ashander/interpolation_methods/languages","stargazers_url":"https://api.github.com/repos/ashander/interpolation_methods/stargazers","contributors_url":"https://api.github.com/repos/ashander/interpolation_methods/contributors","subscribers_url":"https://api.github.com/repos/ashander/interpolation_methods/subscribers","subscription_url":"https://api.github.com/repos/ashander/interpolation_methods/subscription","commits_url":"https://api.github.com/repos/ashander/interpolation_methods/commits{/sha}","git_commits_url":"https://api.github.com/repos/ashander/interpolation_methods/git/commits{/sha}","comments_url":"https://api.github.com/repos/ashander/interpolation_methods/comments{/number}","issue_comment_url":"https://api.github.com/repos/ashander/interpolation_methods/issues/comments{/number}","contents_url":"https://api.github.com/repos/ashander/interpolation_methods/contents/{+path}","compare_url":"https://api.github.com/repos/ashander/interpolation_methods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ashander/interpolation_methods/merges","archive_url":"https://api.github.com/repos/ashander/interpolation_methods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ashander/interpolation_methods/downloads","issues_url":"https://api.github.com/repos/ashander/interpolation_methods/issues{/number}","pulls_url":"https://api.github.com/repos/ashander/interpolation_methods/pulls{/number}","milestones_url":"https://api.github.com/repos/ashander/interpolation_methods/milestones{/number}","notifications_url":"https://api.github.com/repos/ashander/interpolation_methods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ashander/interpolation_methods/labels{/name}","releases_url":"https://api.github.com/repos/ashander/interpolation_methods/releases{/id}","deployments_url":"https://api.github.com/repos/ashander/interpolation_methods/deployments","created_at":"2017-12-20T22:03:54Z","updated_at":"2017-12-20T22:03:56Z","pushed_at":"2017-12-21T08:03:42Z","git_url":"git://github.com/ashander/interpolation_methods.git","ssh_url":"git@github.com:ashander/interpolation_methods.git","clone_url":"https://github.com/ashander/interpolation_methods.git","svn_url":"https://github.com/ashander/interpolation_methods","homepage":null,"size":1354,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"petrelharp:master","ref":"master","sha":"b532fa4c64465c29d51aded9f027850204d04179","user":{"login":"petrelharp","id":1046249,"avatar_url":"https://avatars2.githubusercontent.com/u/1046249?v=4","gravatar_id":"","url":"https://api.github.com/users/petrelharp","html_url":"https://github.com/petrelharp","followers_url":"https://api.github.com/users/petrelharp/followers","following_url":"https://api.github.com/users/petrelharp/following{/other_user}","gists_url":"https://api.github.com/users/petrelharp/gists{/gist_id}","starred_url":"https://api.github.com/users/petrelharp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrelharp/subscriptions","organizations_url":"https://api.github.com/users/petrelharp/orgs","repos_url":"https://api.github.com/users/petrelharp/repos","events_url":"https://api.github.com/users/petrelharp/events{/privacy}","received_events_url":"https://api.github.com/users/petrelharp/received_events","type":"User","site_admin":false},"repo":{"id":114934961,"name":"interpolation_methods","full_name":"petrelharp/interpolation_methods","owner":{"login":"petrelharp","id":1046249,"avatar_url":"https://avatars2.githubusercontent.com/u/1046249?v=4","gravatar_id":"","url":"https://api.github.com/users/petrelharp","html_url":"https://github.com/petrelharp","followers_url":"https://api.github.com/users/petrelharp/followers","following_url":"https://api.github.com/users/petrelharp/following{/other_user}","gists_url":"https://api.github.com/users/petrelharp/gists{/gist_id}","starred_url":"https://api.github.com/users/petrelharp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrelharp/subscriptions","organizations_url":"https://api.github.com/users/petrelharp/orgs","repos_url":"https://api.github.com/users/petrelharp/repos","events_url":"https://api.github.com/users/petrelharp/events{/privacy}","received_events_url":"https://api.github.com/users/petrelharp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petrelharp/interpolation_methods","description":null,"fork":false,"url":"https://api.github.com/repos/petrelharp/interpolation_methods","forks_url":"https://api.github.com/repos/petrelharp/interpolation_methods/forks","keys_url":"https://api.github.com/repos/petrelharp/interpolation_methods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petrelharp/interpolation_methods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petrelharp/interpolation_methods/teams","hooks_url":"https://api.github.com/repos/petrelharp/interpolation_methods/hooks","issue_events_url":"https://api.github.com/repos/petrelharp/interpolation_methods/issues/events{/number}","events_url":"https://api.github.com/repos/petrelharp/interpolation_methods/events","assignees_url":"https://api.github.com/repos/petrelharp/interpolation_methods/assignees{/user}","branches_url":"https://api.github.com/repos/petrelharp/interpolation_methods/branches{/branch}","tags_url":"https://api.github.com/repos/petrelharp/interpolation_methods/tags","blobs_url":"https://api.github.com/repos/petrelharp/interpolation_methods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petrelharp/interpolation_methods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petrelharp/interpolation_methods/git/refs{/sha}","trees_url":"https://api.github.com/repos/petrelharp/interpolation_methods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petrelharp/interpolation_methods/statuses/{sha}","languages_url":"https://api.github.com/repos/petrelharp/interpolation_methods/languages","stargazers_url":"https://api.github.com/repos/petrelharp/interpolation_methods/stargazers","contributors_url":"https://api.github.com/repos/petrelharp/interpolation_methods/contributors","subscribers_url":"https://api.github.com/repos/petrelharp/interpolation_methods/subscribers","subscription_url":"https://api.github.com/repos/petrelharp/interpolation_methods/subscription","commits_url":"https://api.github.com/repos/petrelharp/interpolation_methods/commits{/sha}","git_commits_url":"https://api.github.com/repos/petrelharp/interpolation_methods/git/commits{/sha}","comments_url":"https://api.github.com/repos/petrelharp/interpolation_methods/comments{/number}","issue_comment_url":"https://api.github.com/repos/petrelharp/interpolation_methods/issues/comments{/number}","contents_url":"https://api.github.com/repos/petrelharp/interpolation_methods/contents/{+path}","compare_url":"https://api.github.com/repos/petrelharp/interpolation_methods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petrelharp/interpolation_methods/merges","archive_url":"https://api.github.com/repos/petrelharp/interpolation_methods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petrelharp/interpolation_methods/downloads","issues_url":"https://api.github.com/repos/petrelharp/interpolation_methods/issues{/number}","pulls_url":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls{/number}","milestones_url":"https://api.github.com/repos/petrelharp/interpolation_methods/milestones{/number}","notifications_url":"https://api.github.com/repos/petrelharp/interpolation_methods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petrelharp/interpolation_methods/labels{/name}","releases_url":"https://api.github.com/repos/petrelharp/interpolation_methods/releases{/id}","deployments_url":"https://api.github.com/repos/petrelharp/interpolation_methods/deployments","created_at":"2017-12-20T21:58:24Z","updated_at":"2017-12-20T21:58:48Z","pushed_at":"2017-12-21T08:07:34Z","git_url":"git://github.com/petrelharp/interpolation_methods.git","ssh_url":"git@github.com:petrelharp/interpolation_methods.git","clone_url":"https://github.com/petrelharp/interpolation_methods.git","svn_url":"https://github.com/petrelharp/interpolation_methods","homepage":null,"size":595,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3"},"html":{"href":"https://github.com/petrelharp/interpolation_methods/pull/3"},"issue":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/issues/3"},"comments":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/petrelharp/interpolation_methods/statuses/bde16e495ff9ae8b0220433189918eeb56b37a13"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"petrelharp"}}