{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/comments/84631858","pull_request_review_id":5396314,"id":84631858,"diff_hunk":"@@ -0,0 +1,65 @@\n+import numpy as np\n+import tempfile\n+\n+from sklearn.utils.testing import assert_array_almost_equal\n+from sklearn.utils.testing import assert_array_equal\n+from sklearn.utils.testing import assert_array_less\n+from sklearn.utils.testing import assert_equal\n+from sklearn.utils.testing import assert_not_equal\n+from sklearn.utils.testing import assert_less_equal\n+from sklearn.utils.testing import assert_greater\n+from sklearn.utils.testing import assert_true\n+\n+from skopt import gp_minimize\n+\n+from skopt import load\n+from skopt import dump\n+\n+\n+def obj_fun(x):\n+    return np.sin(5 * x[0]) * (1 - np.tanh(x[0] ** 2))\n+\n+\n+def check_optimization_results_equality(res_1, res_2):\n+    # Check if the results objects have the same keys\n+    assert_equal(res_1.keys(), res_2.keys())\n+    # Shallow check of the main optimization results\n+    assert_array_equal(res_1.x, res_2.x)\n+    assert_array_equal(res_1.x_iters, res_2.x_iters)\n+    assert_array_equal(res_1.fun, res_2.fun)\n+    assert_array_equal(res_1.func_vals, res_2.func_vals)\n+\n+\n+def test_dump_and_load():\n+    res = gp_minimize(obj_fun,\n+                      [(-2.0, 2.0)],\n+                      x0=[0.],\n+                      acq_func=\"LCB\",\n+                      n_calls=2,\n+                      n_random_starts=0,\n+                      random_state=1)\n+\n+    # Test normal dumping and loading\n+    with tempfile.TemporaryFile() as f:\n+        dump(res, f)\n+        f.seek(0)\n+        res_loaded = load(f)\n+    check_optimization_results_equality(res, res_loaded)\n+    assert_true('func' in res_loaded.specs['args'])\n+\n+    # Test dumping without objective function\n+    with tempfile.TemporaryFile() as f:\n+        dump(res, f, store_objective=False)\n+        f.seek(0)","path":"skopt/tests/test_utils.py","position":null,"original_position":53,"commit_id":"07764871d6542738a8ace92103e842d1c637867f","original_commit_id":"1e840b1a8e69b279919805d02cb93ab0e79cc495","user":{"login":"mp4096","id":5394551,"avatar_url":"https://avatars.githubusercontent.com/u/5394551?v=3","gravatar_id":"","url":"https://api.github.com/users/mp4096","html_url":"https://github.com/mp4096","followers_url":"https://api.github.com/users/mp4096/followers","following_url":"https://api.github.com/users/mp4096/following{/other_user}","gists_url":"https://api.github.com/users/mp4096/gists{/gist_id}","starred_url":"https://api.github.com/users/mp4096/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp4096/subscriptions","organizations_url":"https://api.github.com/users/mp4096/orgs","repos_url":"https://api.github.com/users/mp4096/repos","events_url":"https://api.github.com/users/mp4096/events{/privacy}","received_events_url":"https://api.github.com/users/mp4096/received_events","type":"User","site_admin":false},"body":"You're absolutely right, sorry! I just checked that `dump` leaves the seeker at the EOF and haven't thought that `load` itself might do `seek(0)`, which it does.","created_at":"2016-10-24T07:25:04Z","updated_at":"2016-10-24T07:25:05Z","html_url":"https://github.com/scikit-optimize/scikit-optimize/pull/245#discussion_r84631858","pull_request_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245","_links":{"self":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/comments/84631858"},"html":{"href":"https://github.com/scikit-optimize/scikit-optimize/pull/245#discussion_r84631858"},"pull_request":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245","id":88603682,"html_url":"https://github.com/scikit-optimize/scikit-optimize/pull/245","diff_url":"https://github.com/scikit-optimize/scikit-optimize/pull/245.diff","patch_url":"https://github.com/scikit-optimize/scikit-optimize/pull/245.patch","issue_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/issues/245","number":245,"state":"open","locked":false,"title":"Persistence with skopt.dump() and skopt.load()","user":{"login":"mp4096","id":5394551,"avatar_url":"https://avatars.githubusercontent.com/u/5394551?v=3","gravatar_id":"","url":"https://api.github.com/users/mp4096","html_url":"https://github.com/mp4096","followers_url":"https://api.github.com/users/mp4096/followers","following_url":"https://api.github.com/users/mp4096/following{/other_user}","gists_url":"https://api.github.com/users/mp4096/gists{/gist_id}","starred_url":"https://api.github.com/users/mp4096/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp4096/subscriptions","organizations_url":"https://api.github.com/users/mp4096/orgs","repos_url":"https://api.github.com/users/mp4096/repos","events_url":"https://api.github.com/users/mp4096/events{/privacy}","received_events_url":"https://api.github.com/users/mp4096/received_events","type":"User","site_admin":false},"body":"See #190 \r\n\r\nTo do:\r\n- [x] Write unit tests\r\n\r\n~~Be more specific when catching the pickling exception, search for `func` in the error message~~","created_at":"2016-10-10T02:08:17Z","updated_at":"2016-10-24T07:25:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"784bc344480665a0bda60e38ccac389c417bef24","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/milestones/2","html_url":"https://github.com/scikit-optimize/scikit-optimize/milestones/0.2","labels_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/milestones/2/labels","id":1948802,"number":2,"title":"0.2","description":"","creator":{"login":"MechCoder","id":1867024,"avatar_url":"https://avatars.githubusercontent.com/u/1867024?v=3","gravatar_id":"","url":"https://api.github.com/users/MechCoder","html_url":"https://github.com/MechCoder","followers_url":"https://api.github.com/users/MechCoder/followers","following_url":"https://api.github.com/users/MechCoder/following{/other_user}","gists_url":"https://api.github.com/users/MechCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/MechCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MechCoder/subscriptions","organizations_url":"https://api.github.com/users/MechCoder/orgs","repos_url":"https://api.github.com/users/MechCoder/repos","events_url":"https://api.github.com/users/MechCoder/events{/privacy}","received_events_url":"https://api.github.com/users/MechCoder/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":3,"state":"open","created_at":"2016-08-18T06:19:21Z","updated_at":"2016-10-20T15:06:01Z","due_on":"2016-12-01T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245/commits","review_comments_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245/comments","review_comment_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/issues/245/comments","statuses_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/statuses/07764871d6542738a8ace92103e842d1c637867f","head":{"label":"mp4096:dev-save","ref":"dev-save","sha":"07764871d6542738a8ace92103e842d1c637867f","user":{"login":"mp4096","id":5394551,"avatar_url":"https://avatars.githubusercontent.com/u/5394551?v=3","gravatar_id":"","url":"https://api.github.com/users/mp4096","html_url":"https://github.com/mp4096","followers_url":"https://api.github.com/users/mp4096/followers","following_url":"https://api.github.com/users/mp4096/following{/other_user}","gists_url":"https://api.github.com/users/mp4096/gists{/gist_id}","starred_url":"https://api.github.com/users/mp4096/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp4096/subscriptions","organizations_url":"https://api.github.com/users/mp4096/orgs","repos_url":"https://api.github.com/users/mp4096/repos","events_url":"https://api.github.com/users/mp4096/events{/privacy}","received_events_url":"https://api.github.com/users/mp4096/received_events","type":"User","site_admin":false},"repo":{"id":68923542,"name":"scikit-optimize","full_name":"mp4096/scikit-optimize","owner":{"login":"mp4096","id":5394551,"avatar_url":"https://avatars.githubusercontent.com/u/5394551?v=3","gravatar_id":"","url":"https://api.github.com/users/mp4096","html_url":"https://github.com/mp4096","followers_url":"https://api.github.com/users/mp4096/followers","following_url":"https://api.github.com/users/mp4096/following{/other_user}","gists_url":"https://api.github.com/users/mp4096/gists{/gist_id}","starred_url":"https://api.github.com/users/mp4096/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp4096/subscriptions","organizations_url":"https://api.github.com/users/mp4096/orgs","repos_url":"https://api.github.com/users/mp4096/repos","events_url":"https://api.github.com/users/mp4096/events{/privacy}","received_events_url":"https://api.github.com/users/mp4096/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mp4096/scikit-optimize","description":"Sequential model-based optimization with a  `scipy.optimize` interface","fork":true,"url":"https://api.github.com/repos/mp4096/scikit-optimize","forks_url":"https://api.github.com/repos/mp4096/scikit-optimize/forks","keys_url":"https://api.github.com/repos/mp4096/scikit-optimize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mp4096/scikit-optimize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mp4096/scikit-optimize/teams","hooks_url":"https://api.github.com/repos/mp4096/scikit-optimize/hooks","issue_events_url":"https://api.github.com/repos/mp4096/scikit-optimize/issues/events{/number}","events_url":"https://api.github.com/repos/mp4096/scikit-optimize/events","assignees_url":"https://api.github.com/repos/mp4096/scikit-optimize/assignees{/user}","branches_url":"https://api.github.com/repos/mp4096/scikit-optimize/branches{/branch}","tags_url":"https://api.github.com/repos/mp4096/scikit-optimize/tags","blobs_url":"https://api.github.com/repos/mp4096/scikit-optimize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mp4096/scikit-optimize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mp4096/scikit-optimize/git/refs{/sha}","trees_url":"https://api.github.com/repos/mp4096/scikit-optimize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mp4096/scikit-optimize/statuses/{sha}","languages_url":"https://api.github.com/repos/mp4096/scikit-optimize/languages","stargazers_url":"https://api.github.com/repos/mp4096/scikit-optimize/stargazers","contributors_url":"https://api.github.com/repos/mp4096/scikit-optimize/contributors","subscribers_url":"https://api.github.com/repos/mp4096/scikit-optimize/subscribers","subscription_url":"https://api.github.com/repos/mp4096/scikit-optimize/subscription","commits_url":"https://api.github.com/repos/mp4096/scikit-optimize/commits{/sha}","git_commits_url":"https://api.github.com/repos/mp4096/scikit-optimize/git/commits{/sha}","comments_url":"https://api.github.com/repos/mp4096/scikit-optimize/comments{/number}","issue_comment_url":"https://api.github.com/repos/mp4096/scikit-optimize/issues/comments{/number}","contents_url":"https://api.github.com/repos/mp4096/scikit-optimize/contents/{+path}","compare_url":"https://api.github.com/repos/mp4096/scikit-optimize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mp4096/scikit-optimize/merges","archive_url":"https://api.github.com/repos/mp4096/scikit-optimize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mp4096/scikit-optimize/downloads","issues_url":"https://api.github.com/repos/mp4096/scikit-optimize/issues{/number}","pulls_url":"https://api.github.com/repos/mp4096/scikit-optimize/pulls{/number}","milestones_url":"https://api.github.com/repos/mp4096/scikit-optimize/milestones{/number}","notifications_url":"https://api.github.com/repos/mp4096/scikit-optimize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mp4096/scikit-optimize/labels{/name}","releases_url":"https://api.github.com/repos/mp4096/scikit-optimize/releases{/id}","deployments_url":"https://api.github.com/repos/mp4096/scikit-optimize/deployments","created_at":"2016-09-22T13:23:46Z","updated_at":"2016-10-23T15:40:50Z","pushed_at":"2016-10-24T07:23:20Z","git_url":"git://github.com/mp4096/scikit-optimize.git","ssh_url":"git@github.com:mp4096/scikit-optimize.git","clone_url":"https://github.com/mp4096/scikit-optimize.git","svn_url":"https://github.com/mp4096/scikit-optimize","homepage":"https://scikit-optimize.github.io","size":5687,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":"master"}},"base":{"label":"scikit-optimize:master","ref":"master","sha":"0c43d0eca171467d7fcd2d498006aebba25be4da","user":{"login":"scikit-optimize","id":18578550,"avatar_url":"https://avatars.githubusercontent.com/u/18578550?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-optimize","html_url":"https://github.com/scikit-optimize","followers_url":"https://api.github.com/users/scikit-optimize/followers","following_url":"https://api.github.com/users/scikit-optimize/following{/other_user}","gists_url":"https://api.github.com/users/scikit-optimize/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-optimize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-optimize/subscriptions","organizations_url":"https://api.github.com/users/scikit-optimize/orgs","repos_url":"https://api.github.com/users/scikit-optimize/repos","events_url":"https://api.github.com/users/scikit-optimize/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-optimize/received_events","type":"Organization","site_admin":false},"repo":{"id":54340642,"name":"scikit-optimize","full_name":"scikit-optimize/scikit-optimize","owner":{"login":"scikit-optimize","id":18578550,"avatar_url":"https://avatars.githubusercontent.com/u/18578550?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-optimize","html_url":"https://github.com/scikit-optimize","followers_url":"https://api.github.com/users/scikit-optimize/followers","following_url":"https://api.github.com/users/scikit-optimize/following{/other_user}","gists_url":"https://api.github.com/users/scikit-optimize/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-optimize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-optimize/subscriptions","organizations_url":"https://api.github.com/users/scikit-optimize/orgs","repos_url":"https://api.github.com/users/scikit-optimize/repos","events_url":"https://api.github.com/users/scikit-optimize/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-optimize/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-optimize/scikit-optimize","description":"Sequential model-based optimization with a  `scipy.optimize` interface","fork":false,"url":"https://api.github.com/repos/scikit-optimize/scikit-optimize","forks_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/forks","keys_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/teams","hooks_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/hooks","issue_events_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/events","assignees_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/tags","blobs_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/languages","stargazers_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/stargazers","contributors_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/contributors","subscribers_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/subscribers","subscription_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/subscription","commits_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/merges","archive_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/downloads","issues_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/labels{/name}","releases_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/releases{/id}","deployments_url":"https://api.github.com/repos/scikit-optimize/scikit-optimize/deployments","created_at":"2016-03-20T21:10:54Z","updated_at":"2016-10-22T04:06:20Z","pushed_at":"2016-10-24T07:23:21Z","git_url":"git://github.com/scikit-optimize/scikit-optimize.git","ssh_url":"git@github.com:scikit-optimize/scikit-optimize.git","clone_url":"https://github.com/scikit-optimize/scikit-optimize.git","svn_url":"https://github.com/scikit-optimize/scikit-optimize","homepage":"https://scikit-optimize.github.io","size":5835,"stargazers_count":211,"watchers_count":211,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":49,"forks":33,"open_issues":49,"watchers":211,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245"},"html":{"href":"https://github.com/scikit-optimize/scikit-optimize/pull/245"},"issue":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/issues/245"},"comments":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/issues/245/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/pulls/245/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-optimize/scikit-optimize/statuses/07764871d6542738a8ace92103e842d1c637867f"}}}}
{"actor":{"display_login":"mp4096"}}