{"action":"created","comment":{"url":"https://api.github.com/repos/elfi-dev/elfi/pulls/comments/124994117","pull_request_review_id":47321946,"id":124994117,"diff_hunk":"@@ -733,152 +714,207 @@ def current_population_threshold(self):\n class BayesianOptimization(ParameterInference):\n     \"\"\"Bayesian Optimization of an unknown target function.\"\"\"\n \n-    def __init__(self, model, target_name=None, batch_size=1, initial_evidence=None,\n-                 update_interval=10, bounds=None, target_model=None,\n-                 acquisition_method=None, acq_noise_cov=0, **kwargs):\n+    def __init__(self, model, target_name=None, bounds=None, initial_evidence=None,\n+                 update_interval=10, target_model=None, acquisition_method=None,\n+                 acq_noise_var=0, exploration_rate=10, batch_size=1,\n+                 batches_per_acquisition=None, **kwargs):\n         \"\"\"\n         Parameters\n         ----------\n         model : ElfiModel or NodeReference\n         target_name : str or NodeReference\n             Only needed if model is an ElfiModel\n-        target_model : GPyRegression, optional\n-        acquisition_method : Acquisition, optional\n-            Method of acquiring evidence points. Defaults to LCBSC.\n-        acq_noise_cov : float or np.array, optional\n-            Covariance of the noise added in the default LCBSC acquisition method.\n-            If an array, should have the shape (n_params,) or (n_params, n_params).\n         bounds : dict\n             The region where to estimate the posterior for each parameter in\n-            model.parameters.\n-            `{'parameter_name':(lower, upper), ... }`\n+            model.parameters: dict('parameter_name':(lower, upper), ... )`. Not used if\n+            custom target_model is given.\n         initial_evidence : int, dict, optional\n             Number of initial evidence or a precomputed batch dict containing parameter\n-            and discrepancy values. Defaults to max(10, 2**model_input_dim + 1).\n+            and discrepancy values. Default value depends on the dimensionality.\n         update_interval : int\n             How often to update the GP hyperparameters of the target_model\n-        exploration_rate : float\n+        target_model : GPyRegression, optional\n+        acquisition_method : Acquisition, optional\n+            Method of acquiring evidence points. Defaults to LCBSC.\n+        acq_noise_var : float or np.array, optional\n+            Variance(s) of the noise added in the default LCBSC acquisition method.\n+            If an array, should be 1d specifying the variance for each dimension.\n+        exploration_rate : float, optional\n             Exploration rate of the acquisition method\n+        batch_size : int, optional\n+            Elfi batch size. Defaults to 1.\n+        batches_per_acquisition : int, optional\n+            How many batches will be acquired at the same time. Defaults to\n+            max_parallel_batches.\n+        **kwargs\n         \"\"\"\n \n         model, target_name = self._resolve_model(model, target_name)\n         output_names = [target_name] + model.parameter_names\n         super(BayesianOptimization, self).__init__(model, output_names,\n                                                    batch_size=batch_size, **kwargs)\n \n+        target_model = target_model or \\\n+                       GPyRegression(self.model.parameter_names, bounds=bounds)\n+\n         self.target_name = target_name\n-        target_model = \\\n-            target_model or GPyRegression(self.model.parameter_names, bounds=bounds)\n+        self.target_model = target_model\n+\n+        n_precomputed = 0\n+        n_initial, precomputed = self._resolve_initial_evidence(initial_evidence)\n+        if precomputed is not None:\n+            params = batch_to_arr2d(precomputed, self.parameter_names)\n+            n_precomputed = len(params)\n+            self.target_model.update(params, precomputed[target_name])\n+\n+        self.batches_per_acquisition = batches_per_acquisition or self.max_parallel_batches\n+        self.acquisition_method = acquisition_method or \\\n+                                  LCBSC(self.target_model,\n+                                        prior=ModelPrior(self.model),\n+                                        noise_var=acq_noise_var,\n+                                        exploration_rate=exploration_rate,\n+                                        seed=self.seed)\n+\n+        self.n_initial_evidence = n_initial\n+        self.n_precomputed_evidence = n_precomputed\n+        self.update_interval = update_interval\n \n-        # Fix bounds of user-supplied target_model\n-        if type(target_model.bounds) == dict:\n-            target_model.bounds = [target_model.bounds[k] for k in model.parameter_names]","path":"elfi/methods/parameter_inference.py","position":356,"original_position":356,"commit_id":"f034c8ac01ebbe3cc66d4a0f85472a51ac0e14da","original_commit_id":"f034c8ac01ebbe3cc66d4a0f85472a51ac0e14da","user":{"login":"vuolleko","id":1233418,"avatar_url":"https://avatars0.githubusercontent.com/u/1233418?v=3","gravatar_id":"","url":"https://api.github.com/users/vuolleko","html_url":"https://github.com/vuolleko","followers_url":"https://api.github.com/users/vuolleko/followers","following_url":"https://api.github.com/users/vuolleko/following{/other_user}","gists_url":"https://api.github.com/users/vuolleko/gists{/gist_id}","starred_url":"https://api.github.com/users/vuolleko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuolleko/subscriptions","organizations_url":"https://api.github.com/users/vuolleko/orgs","repos_url":"https://api.github.com/users/vuolleko/repos","events_url":"https://api.github.com/users/vuolleko/events{/privacy}","received_events_url":"https://api.github.com/users/vuolleko/received_events","type":"User","site_admin":false},"body":"Why remove this?","created_at":"2017-06-30T09:01:17Z","updated_at":"2017-06-30T09:22:48Z","html_url":"https://github.com/elfi-dev/elfi/pull/197#discussion_r124994117","pull_request_url":"https://api.github.com/repos/elfi-dev/elfi/pulls/197","_links":{"self":{"href":"https://api.github.com/repos/elfi-dev/elfi/pulls/comments/124994117"},"html":{"href":"https://github.com/elfi-dev/elfi/pull/197#discussion_r124994117"},"pull_request":{"href":"https://api.github.com/repos/elfi-dev/elfi/pulls/197"}}},"pull_request":{"url":"https://api.github.com/repos/elfi-dev/elfi/pulls/197","id":128308963,"html_url":"https://github.com/elfi-dev/elfi/pull/197","diff_url":"https://github.com/elfi-dev/elfi/pull/197.diff","patch_url":"https://github.com/elfi-dev/elfi/pull/197.patch","issue_url":"https://api.github.com/repos/elfi-dev/elfi/issues/197","number":197,"state":"open","locked":false,"title":"Consistency tests","user":{"login":"lintusj1","id":22339859,"avatar_url":"https://avatars1.githubusercontent.com/u/22339859?v=3","gravatar_id":"","url":"https://api.github.com/users/lintusj1","html_url":"https://github.com/lintusj1","followers_url":"https://api.github.com/users/lintusj1/followers","following_url":"https://api.github.com/users/lintusj1/following{/other_user}","gists_url":"https://api.github.com/users/lintusj1/gists{/gist_id}","starred_url":"https://api.github.com/users/lintusj1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintusj1/subscriptions","organizations_url":"https://api.github.com/users/lintusj1/orgs","repos_url":"https://api.github.com/users/lintusj1/repos","events_url":"https://api.github.com/users/lintusj1/events{/privacy}","received_events_url":"https://api.github.com/users/lintusj1/received_events","type":"User","site_admin":false},"body":"Adds tests for consistent results given the same seed and initial conditions. Includes quite a bit of refactoring.","created_at":"2017-06-30T07:15:52Z","updated_at":"2017-06-30T09:22:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b4b3484b4439f7d86f55e7bec79064d3d872aa13","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/elfi-dev/elfi/pulls/197/commits","review_comments_url":"https://api.github.com/repos/elfi-dev/elfi/pulls/197/comments","review_comment_url":"https://api.github.com/repos/elfi-dev/elfi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elfi-dev/elfi/issues/197/comments","statuses_url":"https://api.github.com/repos/elfi-dev/elfi/statuses/f034c8ac01ebbe3cc66d4a0f85472a51ac0e14da","head":{"label":"lintusj1:consistency_tests","ref":"consistency_tests","sha":"f034c8ac01ebbe3cc66d4a0f85472a51ac0e14da","user":{"login":"lintusj1","id":22339859,"avatar_url":"https://avatars1.githubusercontent.com/u/22339859?v=3","gravatar_id":"","url":"https://api.github.com/users/lintusj1","html_url":"https://github.com/lintusj1","followers_url":"https://api.github.com/users/lintusj1/followers","following_url":"https://api.github.com/users/lintusj1/following{/other_user}","gists_url":"https://api.github.com/users/lintusj1/gists{/gist_id}","starred_url":"https://api.github.com/users/lintusj1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintusj1/subscriptions","organizations_url":"https://api.github.com/users/lintusj1/orgs","repos_url":"https://api.github.com/users/lintusj1/repos","events_url":"https://api.github.com/users/lintusj1/events{/privacy}","received_events_url":"https://api.github.com/users/lintusj1/received_events","type":"User","site_admin":false},"repo":{"id":87068196,"name":"elfi","full_name":"lintusj1/elfi","owner":{"login":"lintusj1","id":22339859,"avatar_url":"https://avatars1.githubusercontent.com/u/22339859?v=3","gravatar_id":"","url":"https://api.github.com/users/lintusj1","html_url":"https://github.com/lintusj1","followers_url":"https://api.github.com/users/lintusj1/followers","following_url":"https://api.github.com/users/lintusj1/following{/other_user}","gists_url":"https://api.github.com/users/lintusj1/gists{/gist_id}","starred_url":"https://api.github.com/users/lintusj1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintusj1/subscriptions","organizations_url":"https://api.github.com/users/lintusj1/orgs","repos_url":"https://api.github.com/users/lintusj1/repos","events_url":"https://api.github.com/users/lintusj1/events{/privacy}","received_events_url":"https://api.github.com/users/lintusj1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lintusj1/elfi","description":"ELFI - Engine for Likelihood-Free Inference","fork":true,"url":"https://api.github.com/repos/lintusj1/elfi","forks_url":"https://api.github.com/repos/lintusj1/elfi/forks","keys_url":"https://api.github.com/repos/lintusj1/elfi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lintusj1/elfi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lintusj1/elfi/teams","hooks_url":"https://api.github.com/repos/lintusj1/elfi/hooks","issue_events_url":"https://api.github.com/repos/lintusj1/elfi/issues/events{/number}","events_url":"https://api.github.com/repos/lintusj1/elfi/events","assignees_url":"https://api.github.com/repos/lintusj1/elfi/assignees{/user}","branches_url":"https://api.github.com/repos/lintusj1/elfi/branches{/branch}","tags_url":"https://api.github.com/repos/lintusj1/elfi/tags","blobs_url":"https://api.github.com/repos/lintusj1/elfi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lintusj1/elfi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lintusj1/elfi/git/refs{/sha}","trees_url":"https://api.github.com/repos/lintusj1/elfi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lintusj1/elfi/statuses/{sha}","languages_url":"https://api.github.com/repos/lintusj1/elfi/languages","stargazers_url":"https://api.github.com/repos/lintusj1/elfi/stargazers","contributors_url":"https://api.github.com/repos/lintusj1/elfi/contributors","subscribers_url":"https://api.github.com/repos/lintusj1/elfi/subscribers","subscription_url":"https://api.github.com/repos/lintusj1/elfi/subscription","commits_url":"https://api.github.com/repos/lintusj1/elfi/commits{/sha}","git_commits_url":"https://api.github.com/repos/lintusj1/elfi/git/commits{/sha}","comments_url":"https://api.github.com/repos/lintusj1/elfi/comments{/number}","issue_comment_url":"https://api.github.com/repos/lintusj1/elfi/issues/comments{/number}","contents_url":"https://api.github.com/repos/lintusj1/elfi/contents/{+path}","compare_url":"https://api.github.com/repos/lintusj1/elfi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lintusj1/elfi/merges","archive_url":"https://api.github.com/repos/lintusj1/elfi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lintusj1/elfi/downloads","issues_url":"https://api.github.com/repos/lintusj1/elfi/issues{/number}","pulls_url":"https://api.github.com/repos/lintusj1/elfi/pulls{/number}","milestones_url":"https://api.github.com/repos/lintusj1/elfi/milestones{/number}","notifications_url":"https://api.github.com/repos/lintusj1/elfi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lintusj1/elfi/labels{/name}","releases_url":"https://api.github.com/repos/lintusj1/elfi/releases{/id}","deployments_url":"https://api.github.com/repos/lintusj1/elfi/deployments","created_at":"2017-04-03T11:47:32Z","updated_at":"2017-04-03T11:47:33Z","pushed_at":"2017-06-30T07:14:56Z","git_url":"git://github.com/lintusj1/elfi.git","ssh_url":"git@github.com:lintusj1/elfi.git","clone_url":"https://github.com/lintusj1/elfi.git","svn_url":"https://github.com/lintusj1/elfi","homepage":"http://elfi.readthedocs.io","size":966,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"elfi-dev:dev","ref":"dev","sha":"9915f5d1ce4ed9f2fecb748ef62a33bd6b4cfc59","user":{"login":"elfi-dev","id":24249379,"avatar_url":"https://avatars0.githubusercontent.com/u/24249379?v=3","gravatar_id":"","url":"https://api.github.com/users/elfi-dev","html_url":"https://github.com/elfi-dev","followers_url":"https://api.github.com/users/elfi-dev/followers","following_url":"https://api.github.com/users/elfi-dev/following{/other_user}","gists_url":"https://api.github.com/users/elfi-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/elfi-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elfi-dev/subscriptions","organizations_url":"https://api.github.com/users/elfi-dev/orgs","repos_url":"https://api.github.com/users/elfi-dev/repos","events_url":"https://api.github.com/users/elfi-dev/events{/privacy}","received_events_url":"https://api.github.com/users/elfi-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":69855441,"name":"elfi","full_name":"elfi-dev/elfi","owner":{"login":"elfi-dev","id":24249379,"avatar_url":"https://avatars0.githubusercontent.com/u/24249379?v=3","gravatar_id":"","url":"https://api.github.com/users/elfi-dev","html_url":"https://github.com/elfi-dev","followers_url":"https://api.github.com/users/elfi-dev/followers","following_url":"https://api.github.com/users/elfi-dev/following{/other_user}","gists_url":"https://api.github.com/users/elfi-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/elfi-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elfi-dev/subscriptions","organizations_url":"https://api.github.com/users/elfi-dev/orgs","repos_url":"https://api.github.com/users/elfi-dev/repos","events_url":"https://api.github.com/users/elfi-dev/events{/privacy}","received_events_url":"https://api.github.com/users/elfi-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elfi-dev/elfi","description":"ELFI - Engine for Likelihood-Free Inference","fork":false,"url":"https://api.github.com/repos/elfi-dev/elfi","forks_url":"https://api.github.com/repos/elfi-dev/elfi/forks","keys_url":"https://api.github.com/repos/elfi-dev/elfi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elfi-dev/elfi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elfi-dev/elfi/teams","hooks_url":"https://api.github.com/repos/elfi-dev/elfi/hooks","issue_events_url":"https://api.github.com/repos/elfi-dev/elfi/issues/events{/number}","events_url":"https://api.github.com/repos/elfi-dev/elfi/events","assignees_url":"https://api.github.com/repos/elfi-dev/elfi/assignees{/user}","branches_url":"https://api.github.com/repos/elfi-dev/elfi/branches{/branch}","tags_url":"https://api.github.com/repos/elfi-dev/elfi/tags","blobs_url":"https://api.github.com/repos/elfi-dev/elfi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elfi-dev/elfi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elfi-dev/elfi/git/refs{/sha}","trees_url":"https://api.github.com/repos/elfi-dev/elfi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elfi-dev/elfi/statuses/{sha}","languages_url":"https://api.github.com/repos/elfi-dev/elfi/languages","stargazers_url":"https://api.github.com/repos/elfi-dev/elfi/stargazers","contributors_url":"https://api.github.com/repos/elfi-dev/elfi/contributors","subscribers_url":"https://api.github.com/repos/elfi-dev/elfi/subscribers","subscription_url":"https://api.github.com/repos/elfi-dev/elfi/subscription","commits_url":"https://api.github.com/repos/elfi-dev/elfi/commits{/sha}","git_commits_url":"https://api.github.com/repos/elfi-dev/elfi/git/commits{/sha}","comments_url":"https://api.github.com/repos/elfi-dev/elfi/comments{/number}","issue_comment_url":"https://api.github.com/repos/elfi-dev/elfi/issues/comments{/number}","contents_url":"https://api.github.com/repos/elfi-dev/elfi/contents/{+path}","compare_url":"https://api.github.com/repos/elfi-dev/elfi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elfi-dev/elfi/merges","archive_url":"https://api.github.com/repos/elfi-dev/elfi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elfi-dev/elfi/downloads","issues_url":"https://api.github.com/repos/elfi-dev/elfi/issues{/number}","pulls_url":"https://api.github.com/repos/elfi-dev/elfi/pulls{/number}","milestones_url":"https://api.github.com/repos/elfi-dev/elfi/milestones{/number}","notifications_url":"https://api.github.com/repos/elfi-dev/elfi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elfi-dev/elfi/labels{/name}","releases_url":"https://api.github.com/repos/elfi-dev/elfi/releases{/id}","deployments_url":"https://api.github.com/repos/elfi-dev/elfi/deployments","created_at":"2016-10-03T09:03:38Z","updated_at":"2017-06-01T14:09:53Z","pushed_at":"2017-06-30T07:15:53Z","git_url":"git://github.com/elfi-dev/elfi.git","ssh_url":"git@github.com:elfi-dev/elfi.git","clone_url":"https://github.com/elfi-dev/elfi.git","svn_url":"https://github.com/elfi-dev/elfi","homepage":"http://elfi.readthedocs.io","size":912,"stargazers_count":84,"watchers_count":84,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":7,"forks":14,"open_issues":7,"watchers":84,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/elfi-dev/elfi/pulls/197"},"html":{"href":"https://github.com/elfi-dev/elfi/pull/197"},"issue":{"href":"https://api.github.com/repos/elfi-dev/elfi/issues/197"},"comments":{"href":"https://api.github.com/repos/elfi-dev/elfi/issues/197/comments"},"review_comments":{"href":"https://api.github.com/repos/elfi-dev/elfi/pulls/197/comments"},"review_comment":{"href":"https://api.github.com/repos/elfi-dev/elfi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elfi-dev/elfi/pulls/197/commits"},"statuses":{"href":"https://api.github.com/repos/elfi-dev/elfi/statuses/f034c8ac01ebbe3cc66d4a0f85472a51ac0e14da"}}}}
{"actor":{"display_login":"vuolleko"}}