{"action":"created","issue":{"url":"https://api.github.com/repos/florianhartig/BayesianTools/issues/72","repository_url":"https://api.github.com/repos/florianhartig/BayesianTools","labels_url":"https://api.github.com/repos/florianhartig/BayesianTools/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/florianhartig/BayesianTools/issues/72/comments","events_url":"https://api.github.com/repos/florianhartig/BayesianTools/issues/72/events","html_url":"https://github.com/florianhartig/BayesianTools/issues/72","id":272924170,"number":72,"title":"Specifying likelihoods with parallel = \"external\"","user":{"login":"lionel68","id":7189850,"avatar_url":"https://avatars1.githubusercontent.com/u/7189850?v=4","gravatar_id":"","url":"https://api.github.com/users/lionel68","html_url":"https://github.com/lionel68","followers_url":"https://api.github.com/users/lionel68/followers","following_url":"https://api.github.com/users/lionel68/following{/other_user}","gists_url":"https://api.github.com/users/lionel68/gists{/gist_id}","starred_url":"https://api.github.com/users/lionel68/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionel68/subscriptions","organizations_url":"https://api.github.com/users/lionel68/orgs","repos_url":"https://api.github.com/users/lionel68/repos","events_url":"https://api.github.com/users/lionel68/events{/privacy}","received_events_url":"https://api.github.com/users/lionel68/received_events","type":"User","site_admin":false},"labels":[{"id":500832051,"url":"https://api.github.com/repos/florianhartig/BayesianTools/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":{"login":"MaximilianPi","id":29951520,"avatar_url":"https://avatars1.githubusercontent.com/u/29951520?v=4","gravatar_id":"","url":"https://api.github.com/users/MaximilianPi","html_url":"https://github.com/MaximilianPi","followers_url":"https://api.github.com/users/MaximilianPi/followers","following_url":"https://api.github.com/users/MaximilianPi/following{/other_user}","gists_url":"https://api.github.com/users/MaximilianPi/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximilianPi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximilianPi/subscriptions","organizations_url":"https://api.github.com/users/MaximilianPi/orgs","repos_url":"https://api.github.com/users/MaximilianPi/repos","events_url":"https://api.github.com/users/MaximilianPi/events{/privacy}","received_events_url":"https://api.github.com/users/MaximilianPi/received_events","type":"User","site_admin":false},"assignees":[{"login":"MaximilianPi","id":29951520,"avatar_url":"https://avatars1.githubusercontent.com/u/29951520?v=4","gravatar_id":"","url":"https://api.github.com/users/MaximilianPi","html_url":"https://github.com/MaximilianPi","followers_url":"https://api.github.com/users/MaximilianPi/followers","following_url":"https://api.github.com/users/MaximilianPi/following{/other_user}","gists_url":"https://api.github.com/users/MaximilianPi/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximilianPi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximilianPi/subscriptions","organizations_url":"https://api.github.com/users/MaximilianPi/orgs","repos_url":"https://api.github.com/users/MaximilianPi/repos","events_url":"https://api.github.com/users/MaximilianPi/events{/privacy}","received_events_url":"https://api.github.com/users/MaximilianPi/received_events","type":"User","site_admin":false}],"milestone":null,"comments":17,"created_at":"2017-11-10T12:57:08Z","updated_at":"2018-03-19T17:58:29Z","closed_at":null,"author_association":"NONE","body":"I aim at submitting the runMCMC computation to a HPC cluster and to make my jobs more efficient I am trying to work out how to parallelize the code.\r\n\r\nBelow is some dummy code similar to what I am working on:\r\n\r\n`obs <- runif(30,-2,2)\r\n\r\nlik_par <- function(mat_par){\r\n  pred <- apply(mat_par,1,function(par) rnorm(30,par[1],par[2]))\r\n  diff <- pred - obs\r\n  llValues <- dnorm(diff, sd = 1, log = TRUE)  \r\n  return(colSums(llValues))\r\n}\r\n\r\ndensity <- function(par){\r\n  d1 <- dnorm(par[1], 50, 25, log=TRUE) #prior on forest\r\n  d2 <- dnorm(par[2], 10, 10, log=TRUE) #prior on agriculture\r\n  return(d1 + d2)\r\n}\r\nsampler <- function(n=1){\r\n  d1 <- rnorm(n, 50, 25)\r\n  d2 <- rnorm(n, 10, 10)\r\n  return(cbind(d1, d2))\r\n}\r\nprior <- createPrior(density, sampler, lower=rep(0.001,2),upper=rep(100, 2), best=NULL)\r\n\r\nbTMP <- createBayesianSetup(lik_par,prior=prior,parallel = \"external\")\r\n\r\nsettings <- list(iterations = 6, nrChains = 2)\r\nrunMCMC(bayesianSetup = bTMP, settings = settings)`\r\n\r\n\r\n\r\nThis returns: \r\n`Error in if ((logfitness_x_prop[i, 1] - logfitness_X[i, 1] + r_extra[i]) >  : \r\n  missing value where TRUE/FALSE needed`\r\n\r\nI guess that there might be some issue with the prior specification as the prior density / sampler return one value instead of a vector, but I am unsure about which dimensions I should give to the vector. I assume that this should be equal to the number of rows in the parameter matrix given as input to the likelihood function. But I do not know if the user can / should control it."},"comment":{"url":"https://api.github.com/repos/florianhartig/BayesianTools/issues/comments/374307763","html_url":"https://github.com/florianhartig/BayesianTools/issues/72#issuecomment-374307763","issue_url":"https://api.github.com/repos/florianhartig/BayesianTools/issues/72","id":374307763,"user":{"login":"thednainus","id":10168649,"avatar_url":"https://avatars3.githubusercontent.com/u/10168649?v=4","gravatar_id":"","url":"https://api.github.com/users/thednainus","html_url":"https://github.com/thednainus","followers_url":"https://api.github.com/users/thednainus/followers","following_url":"https://api.github.com/users/thednainus/following{/other_user}","gists_url":"https://api.github.com/users/thednainus/gists{/gist_id}","starred_url":"https://api.github.com/users/thednainus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thednainus/subscriptions","organizations_url":"https://api.github.com/users/thednainus/orgs","repos_url":"https://api.github.com/users/thednainus/repos","events_url":"https://api.github.com/users/thednainus/events{/privacy}","received_events_url":"https://api.github.com/users/thednainus/received_events","type":"User","site_admin":false},"created_at":"2018-03-19T17:58:29Z","updated_at":"2018-03-19T17:58:29Z","author_association":"NONE","body":"Just as a note. I downloaded the development version of BT (as suggested by e-mail from your student Max), and parallel is now working for my case. I did create a prior setting up a lower and upper bound for it, and I set `parallel = 4`."}}
{"actor":{"display_login":"thednainus"}}