{"action":"created","comment":{"url":"https://api.github.com/repos/pfnet/chainer/pulls/comments/69499484","id":69499484,"diff_hunk":"@@ -0,0 +1,157 @@\n+import numpy\n+import six\n+\n+from chainer.dataset import dataset_mixin\n+\n+\n+class SubDataset(dataset_mixin.DatasetMixin):\n+\n+    \"\"\"Subset of a base dataset.\n+\n+    SubDataset defines a subset of a given base dataset. The subset is defined\n+    as an interval of indexes, optionally with a given permutation.\n+\n+    If ``order`` is given, then the ``i``-th example of this dataset is the\n+    ``order[start + i]``-th example of the base dataset, where ``i`` is a\n+    non-negative integer. If ``order`` is not given, then the ``i``-th example\n+    of this dataset is the ``start + i``-th example of the base dataset.\n+    Negative indexing is also allowed: in this case, the term ``start + i`` is\n+    replaced by ``finish + i``.\n+\n+    Args:\n+        dataset: Base dataset.\n+        start (int): The first index in the interval.\n+        finish (int): The next-to-the-last index in the interval.\n+        order (sequence of ints): Permutation of indexes in the base dataset.\n+            If this is None, then the ascending order of indexes is used.\n+\n+    \"\"\"\n+    def __init__(self, dataset, start, finish, order=None):\n+        if start < 0 or finish > len(dataset):\n+            raise ValueError('subset overruns the base dataset.')\n+        self._dataset = dataset\n+        self._start = start\n+        self._finish = finish\n+        self._size = finish - start\n+        self._order = order","path":"chainer/datasets/sub_dataset.py","position":null,"original_position":36,"commit_id":"8b4abb193a6d761d18360582a79e07477f57c4ec","original_commit_id":"d73b91c384f352247dda8fa8e704023d7982e7ea","user":{"login":"beam2d","id":392019,"avatar_url":"https://avatars.githubusercontent.com/u/392019?v=3","gravatar_id":"","url":"https://api.github.com/users/beam2d","html_url":"https://github.com/beam2d","followers_url":"https://api.github.com/users/beam2d/followers","following_url":"https://api.github.com/users/beam2d/following{/other_user}","gists_url":"https://api.github.com/users/beam2d/gists{/gist_id}","starred_url":"https://api.github.com/users/beam2d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beam2d/subscriptions","organizations_url":"https://api.github.com/users/beam2d/orgs","repos_url":"https://api.github.com/users/beam2d/repos","events_url":"https://api.github.com/users/beam2d/events{/privacy}","received_events_url":"https://api.github.com/users/beam2d/received_events","type":"User","site_admin":false},"body":"I think we implicitly impose that `dataset` supports the dataset interface (i.e., it should have `__getitem__` and `__len__` operators). Do we have to explicitly check them? I think most of the current codes that use dataset do not check them explicitly.","created_at":"2016-07-05T01:48:34Z","updated_at":"2016-07-05T01:48:34Z","html_url":"https://github.com/pfnet/chainer/pull/1285#discussion_r69499484","pull_request_url":"https://api.github.com/repos/pfnet/chainer/pulls/1285","_links":{"self":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/comments/69499484"},"html":{"href":"https://github.com/pfnet/chainer/pull/1285#discussion_r69499484"},"pull_request":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/1285"}}},"pull_request":{"url":"https://api.github.com/repos/pfnet/chainer/pulls/1285","id":74042786,"html_url":"https://github.com/pfnet/chainer/pull/1285","diff_url":"https://github.com/pfnet/chainer/pull/1285.diff","patch_url":"https://github.com/pfnet/chainer/pull/1285.patch","issue_url":"https://api.github.com/repos/pfnet/chainer/issues/1285","number":1285,"state":"open","locked":false,"title":"Trainer2","user":{"login":"beam2d","id":392019,"avatar_url":"https://avatars.githubusercontent.com/u/392019?v=3","gravatar_id":"","url":"https://api.github.com/users/beam2d","html_url":"https://github.com/beam2d","followers_url":"https://api.github.com/users/beam2d/followers","following_url":"https://api.github.com/users/beam2d/following{/other_user}","gists_url":"https://api.github.com/users/beam2d/gists{/gist_id}","starred_url":"https://api.github.com/users/beam2d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beam2d/subscriptions","organizations_url":"https://api.github.com/users/beam2d/orgs","repos_url":"https://api.github.com/users/beam2d/repos","events_url":"https://api.github.com/users/beam2d/events{/privacy}","received_events_url":"https://api.github.com/users/beam2d/received_events","type":"User","site_admin":false},"body":"fix #914. I wrote an updated version of the training loop abstraction. This includes many improvements based on the feedback to the old version (#958). For example,\r\n\r\n- Design around the dataset abstraction is improved. Most considerable applications are supported with some efforts of customization.\r\n- New Trainer supports using multiple datasets and multiple optimizers.\r\n- Evaluation report is abstracted into Reporter object. This makes it easy to collect many observable values like loss/accuracy, activation statistics, etc.\r\n\r\nI have not updated the tutorial document yet, which should be done before merging it.","created_at":"2016-06-16T08:45:48Z","updated_at":"2016-07-05T01:48:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec89962a97b8bd74fe7201953ade5da9243f9b11","assignee":{"login":"delta2323","id":407052,"avatar_url":"https://avatars.githubusercontent.com/u/407052?v=3","gravatar_id":"","url":"https://api.github.com/users/delta2323","html_url":"https://github.com/delta2323","followers_url":"https://api.github.com/users/delta2323/followers","following_url":"https://api.github.com/users/delta2323/following{/other_user}","gists_url":"https://api.github.com/users/delta2323/gists{/gist_id}","starred_url":"https://api.github.com/users/delta2323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta2323/subscriptions","organizations_url":"https://api.github.com/users/delta2323/orgs","repos_url":"https://api.github.com/users/delta2323/repos","events_url":"https://api.github.com/users/delta2323/events{/privacy}","received_events_url":"https://api.github.com/users/delta2323/received_events","type":"User","site_admin":false},"assignees":[{"login":"delta2323","id":407052,"avatar_url":"https://avatars.githubusercontent.com/u/407052?v=3","gravatar_id":"","url":"https://api.github.com/users/delta2323","html_url":"https://github.com/delta2323","followers_url":"https://api.github.com/users/delta2323/followers","following_url":"https://api.github.com/users/delta2323/following{/other_user}","gists_url":"https://api.github.com/users/delta2323/gists{/gist_id}","starred_url":"https://api.github.com/users/delta2323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta2323/subscriptions","organizations_url":"https://api.github.com/users/delta2323/orgs","repos_url":"https://api.github.com/users/delta2323/repos","events_url":"https://api.github.com/users/delta2323/events{/privacy}","received_events_url":"https://api.github.com/users/delta2323/received_events","type":"User","site_admin":false},{"login":"unnonouno","id":740680,"avatar_url":"https://avatars.githubusercontent.com/u/740680?v=3","gravatar_id":"","url":"https://api.github.com/users/unnonouno","html_url":"https://github.com/unnonouno","followers_url":"https://api.github.com/users/unnonouno/followers","following_url":"https://api.github.com/users/unnonouno/following{/other_user}","gists_url":"https://api.github.com/users/unnonouno/gists{/gist_id}","starred_url":"https://api.github.com/users/unnonouno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unnonouno/subscriptions","organizations_url":"https://api.github.com/users/unnonouno/orgs","repos_url":"https://api.github.com/users/unnonouno/repos","events_url":"https://api.github.com/users/unnonouno/events{/privacy}","received_events_url":"https://api.github.com/users/unnonouno/received_events","type":"User","site_admin":false},{"login":"bkvogel","id":12666050,"avatar_url":"https://avatars.githubusercontent.com/u/12666050?v=3","gravatar_id":"","url":"https://api.github.com/users/bkvogel","html_url":"https://github.com/bkvogel","followers_url":"https://api.github.com/users/bkvogel/followers","following_url":"https://api.github.com/users/bkvogel/following{/other_user}","gists_url":"https://api.github.com/users/bkvogel/gists{/gist_id}","starred_url":"https://api.github.com/users/bkvogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkvogel/subscriptions","organizations_url":"https://api.github.com/users/bkvogel/orgs","repos_url":"https://api.github.com/users/bkvogel/repos","events_url":"https://api.github.com/users/bkvogel/events{/privacy}","received_events_url":"https://api.github.com/users/bkvogel/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pfnet/chainer/pulls/1285/commits","review_comments_url":"https://api.github.com/repos/pfnet/chainer/pulls/1285/comments","review_comment_url":"https://api.github.com/repos/pfnet/chainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pfnet/chainer/issues/1285/comments","statuses_url":"https://api.github.com/repos/pfnet/chainer/statuses/8b4abb193a6d761d18360582a79e07477f57c4ec","head":{"label":"pfnet:trainer2","ref":"trainer2","sha":"8b4abb193a6d761d18360582a79e07477f57c4ec","user":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"repo":{"id":36914478,"name":"chainer","full_name":"pfnet/chainer","owner":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pfnet/chainer","description":"A flexible framework of neural networks for deep learning","fork":false,"url":"https://api.github.com/repos/pfnet/chainer","forks_url":"https://api.github.com/repos/pfnet/chainer/forks","keys_url":"https://api.github.com/repos/pfnet/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet/chainer/teams","hooks_url":"https://api.github.com/repos/pfnet/chainer/hooks","issue_events_url":"https://api.github.com/repos/pfnet/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet/chainer/events","assignees_url":"https://api.github.com/repos/pfnet/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet/chainer/tags","blobs_url":"https://api.github.com/repos/pfnet/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet/chainer/languages","stargazers_url":"https://api.github.com/repos/pfnet/chainer/stargazers","contributors_url":"https://api.github.com/repos/pfnet/chainer/contributors","subscribers_url":"https://api.github.com/repos/pfnet/chainer/subscribers","subscription_url":"https://api.github.com/repos/pfnet/chainer/subscription","commits_url":"https://api.github.com/repos/pfnet/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet/chainer/merges","archive_url":"https://api.github.com/repos/pfnet/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet/chainer/downloads","issues_url":"https://api.github.com/repos/pfnet/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet/chainer/labels{/name}","releases_url":"https://api.github.com/repos/pfnet/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/pfnet/chainer/deployments","created_at":"2015-06-05T05:50:37Z","updated_at":"2016-07-04T21:00:52Z","pushed_at":"2016-07-05T01:47:14Z","git_url":"git://github.com/pfnet/chainer.git","ssh_url":"git@github.com:pfnet/chainer.git","clone_url":"https://github.com/pfnet/chainer.git","svn_url":"https://github.com/pfnet/chainer","homepage":"http://chainer.org","size":23495,"stargazers_count":1480,"watchers_count":1480,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":342,"mirror_url":null,"open_issues_count":181,"forks":342,"open_issues":181,"watchers":1480,"default_branch":"master"}},"base":{"label":"pfnet:master","ref":"master","sha":"6a63b31b78fccf34c6357a0b9788a824aadc7a0a","user":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"repo":{"id":36914478,"name":"chainer","full_name":"pfnet/chainer","owner":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pfnet/chainer","description":"A flexible framework of neural networks for deep learning","fork":false,"url":"https://api.github.com/repos/pfnet/chainer","forks_url":"https://api.github.com/repos/pfnet/chainer/forks","keys_url":"https://api.github.com/repos/pfnet/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet/chainer/teams","hooks_url":"https://api.github.com/repos/pfnet/chainer/hooks","issue_events_url":"https://api.github.com/repos/pfnet/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet/chainer/events","assignees_url":"https://api.github.com/repos/pfnet/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet/chainer/tags","blobs_url":"https://api.github.com/repos/pfnet/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet/chainer/languages","stargazers_url":"https://api.github.com/repos/pfnet/chainer/stargazers","contributors_url":"https://api.github.com/repos/pfnet/chainer/contributors","subscribers_url":"https://api.github.com/repos/pfnet/chainer/subscribers","subscription_url":"https://api.github.com/repos/pfnet/chainer/subscription","commits_url":"https://api.github.com/repos/pfnet/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet/chainer/merges","archive_url":"https://api.github.com/repos/pfnet/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet/chainer/downloads","issues_url":"https://api.github.com/repos/pfnet/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet/chainer/labels{/name}","releases_url":"https://api.github.com/repos/pfnet/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/pfnet/chainer/deployments","created_at":"2015-06-05T05:50:37Z","updated_at":"2016-07-04T21:00:52Z","pushed_at":"2016-07-05T01:47:14Z","git_url":"git://github.com/pfnet/chainer.git","ssh_url":"git@github.com:pfnet/chainer.git","clone_url":"https://github.com/pfnet/chainer.git","svn_url":"https://github.com/pfnet/chainer","homepage":"http://chainer.org","size":23495,"stargazers_count":1480,"watchers_count":1480,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":342,"mirror_url":null,"open_issues_count":181,"forks":342,"open_issues":181,"watchers":1480,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/1285"},"html":{"href":"https://github.com/pfnet/chainer/pull/1285"},"issue":{"href":"https://api.github.com/repos/pfnet/chainer/issues/1285"},"comments":{"href":"https://api.github.com/repos/pfnet/chainer/issues/1285/comments"},"review_comments":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/1285/comments"},"review_comment":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/1285/commits"},"statuses":{"href":"https://api.github.com/repos/pfnet/chainer/statuses/8b4abb193a6d761d18360582a79e07477f57c4ec"}}}}
{"actor":{"display_login":"beam2d"}}