{"action":"created","comment":{"url":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/comments/103042564","pull_request_review_id":23822196,"id":103042564,"diff_hunk":"@@ -0,0 +1,54 @@\n+import sklearn.datasets.mldata\n+import sklearn.model_selection\n+import numpy\n+from config import DATA_HOME\n+\n+__all__ = ['MNIST', 'train_creator', 'test_creator']\n+\n+\n+def __mnist_reader_creator__(data, target):\n+    def reader():\n+        n_samples = data.shape[0]\n+        for i in xrange(n_samples):\n+            yield (data[i] / 255.0).astype(numpy.float32), int(target[i])\n+\n+    return reader\n+\n+\n+class MNIST(object):\n+    \"\"\"\n+    mnist dataset reader. The `train_reader` and `test_reader` method returns\n+    a iterator of each sample. Each sample is combined by 784-dim float and a\n+    one-dim label\n+    \"\"\"\n+\n+    def __init__(self, random_state=0, test_size=10000, **options):\n+        data = sklearn.datasets.mldata.fetch_mldata(\n+            \"MNIST original\", data_home=DATA_HOME)\n+        self.X_train, self.X_test, self.y_train, self.y_test = sklearn.model_selection.train_test_split(\n+            data.data,\n+            data.target,\n+            test_size=test_size,\n+            random_state=random_state,\n+            **options)\n+\n+    def train_creator(self):\n+        return __mnist_reader_creator__(self.X_train, self.y_train)\n+\n+    def test_creator(self):\n+        return __mnist_reader_creator__(self.X_test, self.y_test)\n+\n+\n+__default_instance__ = MNIST()\n+train_creator = __default_instance__.train_creator\n+test_creator = __default_instance__.test_creator\n+\n+\n+def unittest():\n+    size = 12045\n+    mnist = MNIST(test_size=size)","path":"python/paddle/v2/data_set/mnist.py","position":49,"original_position":49,"commit_id":"976a6982baa8a5fb4839d036f7f403ef4b22b0c7","original_commit_id":"976a6982baa8a5fb4839d036f7f403ef4b22b0c7","user":{"login":"wangkuiyi","id":1548775,"avatar_url":"https://avatars.githubusercontent.com/u/1548775?v=3","gravatar_id":"","url":"https://api.github.com/users/wangkuiyi","html_url":"https://github.com/wangkuiyi","followers_url":"https://api.github.com/users/wangkuiyi/followers","following_url":"https://api.github.com/users/wangkuiyi/following{/other_user}","gists_url":"https://api.github.com/users/wangkuiyi/gists{/gist_id}","starred_url":"https://api.github.com/users/wangkuiyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangkuiyi/subscriptions","organizations_url":"https://api.github.com/users/wangkuiyi/orgs","repos_url":"https://api.github.com/users/wangkuiyi/repos","events_url":"https://api.github.com/users/wangkuiyi/events{/privacy}","received_events_url":"https://api.github.com/users/wangkuiyi/received_events","type":"User","site_admin":false},"body":"这里package已经叫mnist了，没道理让用户写\r\n\r\n```python\r\npaddle.dataset.mnist.MNIST(size).test_creator()\r\n```\r\n\r\n这么长","created_at":"2017-02-24T22:02:06Z","updated_at":"2017-02-24T22:02:32Z","html_url":"https://github.com/PaddlePaddle/Paddle/pull/1450#discussion_r103042564","pull_request_url":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450","_links":{"self":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/comments/103042564"},"html":{"href":"https://github.com/PaddlePaddle/Paddle/pull/1450#discussion_r103042564"},"pull_request":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450"}}},"pull_request":{"url":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450","id":107788790,"html_url":"https://github.com/PaddlePaddle/Paddle/pull/1450","diff_url":"https://github.com/PaddlePaddle/Paddle/pull/1450.diff","patch_url":"https://github.com/PaddlePaddle/Paddle/pull/1450.patch","issue_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/1450","number":1450,"state":"open","locked":false,"title":"Feature/cifar dataset","user":{"login":"reyoung","id":728699,"avatar_url":"https://avatars.githubusercontent.com/u/728699?v=3","gravatar_id":"","url":"https://api.github.com/users/reyoung","html_url":"https://github.com/reyoung","followers_url":"https://api.github.com/users/reyoung/followers","following_url":"https://api.github.com/users/reyoung/following{/other_user}","gists_url":"https://api.github.com/users/reyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/reyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reyoung/subscriptions","organizations_url":"https://api.github.com/users/reyoung/orgs","repos_url":"https://api.github.com/users/reyoung/repos","events_url":"https://api.github.com/users/reyoung/events{/privacy}","received_events_url":"https://api.github.com/users/reyoung/received_events","type":"User","site_admin":false},"body":"Please review #1438 first.","created_at":"2017-02-24T08:47:00Z","updated_at":"2017-02-24T22:02:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4983ccdee1ac3b3045feccdbd23da5d81ebd0b40","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450/commits","review_comments_url":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450/comments","review_comment_url":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/1450/comments","statuses_url":"https://api.github.com/repos/PaddlePaddle/Paddle/statuses/976a6982baa8a5fb4839d036f7f403ef4b22b0c7","head":{"label":"reyoung:feature/cifar_dataset","ref":"feature/cifar_dataset","sha":"976a6982baa8a5fb4839d036f7f403ef4b22b0c7","user":{"login":"reyoung","id":728699,"avatar_url":"https://avatars.githubusercontent.com/u/728699?v=3","gravatar_id":"","url":"https://api.github.com/users/reyoung","html_url":"https://github.com/reyoung","followers_url":"https://api.github.com/users/reyoung/followers","following_url":"https://api.github.com/users/reyoung/following{/other_user}","gists_url":"https://api.github.com/users/reyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/reyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reyoung/subscriptions","organizations_url":"https://api.github.com/users/reyoung/orgs","repos_url":"https://api.github.com/users/reyoung/repos","events_url":"https://api.github.com/users/reyoung/events{/privacy}","received_events_url":"https://api.github.com/users/reyoung/received_events","type":"User","site_admin":false},"repo":{"id":67185903,"name":"Paddle","full_name":"reyoung/Paddle","owner":{"login":"reyoung","id":728699,"avatar_url":"https://avatars.githubusercontent.com/u/728699?v=3","gravatar_id":"","url":"https://api.github.com/users/reyoung","html_url":"https://github.com/reyoung","followers_url":"https://api.github.com/users/reyoung/followers","following_url":"https://api.github.com/users/reyoung/following{/other_user}","gists_url":"https://api.github.com/users/reyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/reyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reyoung/subscriptions","organizations_url":"https://api.github.com/users/reyoung/orgs","repos_url":"https://api.github.com/users/reyoung/repos","events_url":"https://api.github.com/users/reyoung/events{/privacy}","received_events_url":"https://api.github.com/users/reyoung/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reyoung/Paddle","description":"PArallel Distributed Deep LEarning","fork":true,"url":"https://api.github.com/repos/reyoung/Paddle","forks_url":"https://api.github.com/repos/reyoung/Paddle/forks","keys_url":"https://api.github.com/repos/reyoung/Paddle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reyoung/Paddle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reyoung/Paddle/teams","hooks_url":"https://api.github.com/repos/reyoung/Paddle/hooks","issue_events_url":"https://api.github.com/repos/reyoung/Paddle/issues/events{/number}","events_url":"https://api.github.com/repos/reyoung/Paddle/events","assignees_url":"https://api.github.com/repos/reyoung/Paddle/assignees{/user}","branches_url":"https://api.github.com/repos/reyoung/Paddle/branches{/branch}","tags_url":"https://api.github.com/repos/reyoung/Paddle/tags","blobs_url":"https://api.github.com/repos/reyoung/Paddle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reyoung/Paddle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reyoung/Paddle/git/refs{/sha}","trees_url":"https://api.github.com/repos/reyoung/Paddle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reyoung/Paddle/statuses/{sha}","languages_url":"https://api.github.com/repos/reyoung/Paddle/languages","stargazers_url":"https://api.github.com/repos/reyoung/Paddle/stargazers","contributors_url":"https://api.github.com/repos/reyoung/Paddle/contributors","subscribers_url":"https://api.github.com/repos/reyoung/Paddle/subscribers","subscription_url":"https://api.github.com/repos/reyoung/Paddle/subscription","commits_url":"https://api.github.com/repos/reyoung/Paddle/commits{/sha}","git_commits_url":"https://api.github.com/repos/reyoung/Paddle/git/commits{/sha}","comments_url":"https://api.github.com/repos/reyoung/Paddle/comments{/number}","issue_comment_url":"https://api.github.com/repos/reyoung/Paddle/issues/comments{/number}","contents_url":"https://api.github.com/repos/reyoung/Paddle/contents/{+path}","compare_url":"https://api.github.com/repos/reyoung/Paddle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reyoung/Paddle/merges","archive_url":"https://api.github.com/repos/reyoung/Paddle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reyoung/Paddle/downloads","issues_url":"https://api.github.com/repos/reyoung/Paddle/issues{/number}","pulls_url":"https://api.github.com/repos/reyoung/Paddle/pulls{/number}","milestones_url":"https://api.github.com/repos/reyoung/Paddle/milestones{/number}","notifications_url":"https://api.github.com/repos/reyoung/Paddle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reyoung/Paddle/labels{/name}","releases_url":"https://api.github.com/repos/reyoung/Paddle/releases{/id}","deployments_url":"https://api.github.com/repos/reyoung/Paddle/deployments","created_at":"2016-09-02T03:14:43Z","updated_at":"2016-09-02T03:14:46Z","pushed_at":"2017-02-24T08:46:35Z","git_url":"git://github.com/reyoung/Paddle.git","ssh_url":"git@github.com:reyoung/Paddle.git","clone_url":"https://github.com/reyoung/Paddle.git","svn_url":"https://github.com/reyoung/Paddle","homepage":"http://www.paddlepaddle.org/","size":19786,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"PaddlePaddle:develop","ref":"develop","sha":"c45195746bbe57e7c3a6d8b46666fa11a6dfdf20","user":{"login":"PaddlePaddle","id":23534030,"avatar_url":"https://avatars.githubusercontent.com/u/23534030?v=3","gravatar_id":"","url":"https://api.github.com/users/PaddlePaddle","html_url":"https://github.com/PaddlePaddle","followers_url":"https://api.github.com/users/PaddlePaddle/followers","following_url":"https://api.github.com/users/PaddlePaddle/following{/other_user}","gists_url":"https://api.github.com/users/PaddlePaddle/gists{/gist_id}","starred_url":"https://api.github.com/users/PaddlePaddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaddlePaddle/subscriptions","organizations_url":"https://api.github.com/users/PaddlePaddle/orgs","repos_url":"https://api.github.com/users/PaddlePaddle/repos","events_url":"https://api.github.com/users/PaddlePaddle/events{/privacy}","received_events_url":"https://api.github.com/users/PaddlePaddle/received_events","type":"Organization","site_admin":false},"repo":{"id":65711522,"name":"Paddle","full_name":"PaddlePaddle/Paddle","owner":{"login":"PaddlePaddle","id":23534030,"avatar_url":"https://avatars.githubusercontent.com/u/23534030?v=3","gravatar_id":"","url":"https://api.github.com/users/PaddlePaddle","html_url":"https://github.com/PaddlePaddle","followers_url":"https://api.github.com/users/PaddlePaddle/followers","following_url":"https://api.github.com/users/PaddlePaddle/following{/other_user}","gists_url":"https://api.github.com/users/PaddlePaddle/gists{/gist_id}","starred_url":"https://api.github.com/users/PaddlePaddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaddlePaddle/subscriptions","organizations_url":"https://api.github.com/users/PaddlePaddle/orgs","repos_url":"https://api.github.com/users/PaddlePaddle/repos","events_url":"https://api.github.com/users/PaddlePaddle/events{/privacy}","received_events_url":"https://api.github.com/users/PaddlePaddle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PaddlePaddle/Paddle","description":"PArallel Distributed Deep LEarning","fork":false,"url":"https://api.github.com/repos/PaddlePaddle/Paddle","forks_url":"https://api.github.com/repos/PaddlePaddle/Paddle/forks","keys_url":"https://api.github.com/repos/PaddlePaddle/Paddle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PaddlePaddle/Paddle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PaddlePaddle/Paddle/teams","hooks_url":"https://api.github.com/repos/PaddlePaddle/Paddle/hooks","issue_events_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/events{/number}","events_url":"https://api.github.com/repos/PaddlePaddle/Paddle/events","assignees_url":"https://api.github.com/repos/PaddlePaddle/Paddle/assignees{/user}","branches_url":"https://api.github.com/repos/PaddlePaddle/Paddle/branches{/branch}","tags_url":"https://api.github.com/repos/PaddlePaddle/Paddle/tags","blobs_url":"https://api.github.com/repos/PaddlePaddle/Paddle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PaddlePaddle/Paddle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PaddlePaddle/Paddle/git/refs{/sha}","trees_url":"https://api.github.com/repos/PaddlePaddle/Paddle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PaddlePaddle/Paddle/statuses/{sha}","languages_url":"https://api.github.com/repos/PaddlePaddle/Paddle/languages","stargazers_url":"https://api.github.com/repos/PaddlePaddle/Paddle/stargazers","contributors_url":"https://api.github.com/repos/PaddlePaddle/Paddle/contributors","subscribers_url":"https://api.github.com/repos/PaddlePaddle/Paddle/subscribers","subscription_url":"https://api.github.com/repos/PaddlePaddle/Paddle/subscription","commits_url":"https://api.github.com/repos/PaddlePaddle/Paddle/commits{/sha}","git_commits_url":"https://api.github.com/repos/PaddlePaddle/Paddle/git/commits{/sha}","comments_url":"https://api.github.com/repos/PaddlePaddle/Paddle/comments{/number}","issue_comment_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/comments{/number}","contents_url":"https://api.github.com/repos/PaddlePaddle/Paddle/contents/{+path}","compare_url":"https://api.github.com/repos/PaddlePaddle/Paddle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PaddlePaddle/Paddle/merges","archive_url":"https://api.github.com/repos/PaddlePaddle/Paddle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PaddlePaddle/Paddle/downloads","issues_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues{/number}","pulls_url":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls{/number}","milestones_url":"https://api.github.com/repos/PaddlePaddle/Paddle/milestones{/number}","notifications_url":"https://api.github.com/repos/PaddlePaddle/Paddle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PaddlePaddle/Paddle/labels{/name}","releases_url":"https://api.github.com/repos/PaddlePaddle/Paddle/releases{/id}","deployments_url":"https://api.github.com/repos/PaddlePaddle/Paddle/deployments","created_at":"2016-08-15T06:59:08Z","updated_at":"2017-02-24T18:33:25Z","pushed_at":"2017-02-24T21:48:00Z","git_url":"git://github.com/PaddlePaddle/Paddle.git","ssh_url":"git@github.com:PaddlePaddle/Paddle.git","clone_url":"https://github.com/PaddlePaddle/Paddle.git","svn_url":"https://github.com/PaddlePaddle/Paddle","homepage":"http://www.paddlepaddle.org/","size":19976,"stargazers_count":4412,"watchers_count":4412,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1133,"mirror_url":null,"open_issues_count":293,"forks":1133,"open_issues":293,"watchers":4412,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450"},"html":{"href":"https://github.com/PaddlePaddle/Paddle/pull/1450"},"issue":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/1450"},"comments":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/1450/comments"},"review_comments":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450/comments"},"review_comment":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/pulls/1450/commits"},"statuses":{"href":"https://api.github.com/repos/PaddlePaddle/Paddle/statuses/976a6982baa8a5fb4839d036f7f403ef4b22b0c7"}}}}
{"actor":{"display_login":"wangkuiyi"}}