{"action":"created","comment":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/59445167","id":59445167,"diff_hunk":"@@ -0,0 +1,155 @@\n+#ifndef __MLPACK_CORE_UTIL_SPLIT_DATA_HPP\n+#define __MLPACK_CORE_UTIL_SPLIT_DATA_HPP\n+\n+#include <mlpack/core.hpp>\n+\n+#include <iterator>\n+#include <numeric>\n+#include <random>\n+#include <tuple>\n+#include <vector>\n+\n+namespace mlpack {\n+namespace util {\n+\n+/**\n+ *Split training data and test data, please define\n+ *ARMA_USE_CXX11 to enable move of c++11\n+ */\n+class TrainTestSplit\n+{\n+public:\n+  /**\n+   * @brief TrainTestSplit\n+   * @param testRatio the ratio of test data\n+   * @param seed seed of the random device\n+   * @warning slice should not less than 1\n+   */\n+  TrainTestSplit(double testRatio,                \n+                 arma::arma_rng::seed_type seed = 0) :\n+    seed(seed),    \n+    testRatio(testRatio)\n+  {    \n+  }\n+\n+  /**\n+   *Split training data and test data, please define\n+   *ARMA_USE_CXX11 to enable move of c++11","path":"src/mlpack/core/util/split_data.hpp","position":37,"original_position":37,"commit_id":"860256202d7cba23dd3500a05e36ecd351f1d673","original_commit_id":"860256202d7cba23dd3500a05e36ecd351f1d673","user":{"login":"rcurtin","id":1845039,"avatar_url":"https://avatars.githubusercontent.com/u/1845039?v=3","gravatar_id":"","url":"https://api.github.com/users/rcurtin","html_url":"https://github.com/rcurtin","followers_url":"https://api.github.com/users/rcurtin/followers","following_url":"https://api.github.com/users/rcurtin/following{/other_user}","gists_url":"https://api.github.com/users/rcurtin/gists{/gist_id}","starred_url":"https://api.github.com/users/rcurtin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcurtin/subscriptions","organizations_url":"https://api.github.com/users/rcurtin/orgs","repos_url":"https://api.github.com/users/rcurtin/repos","events_url":"https://api.github.com/users/rcurtin/events{/privacy}","received_events_url":"https://api.github.com/users/rcurtin/received_events","type":"User","site_admin":false},"body":"mlpack requires C++11 so I think we can assume that `ARMA_USE_CXX11` is enabled without any issues.","created_at":"2016-04-12T20:14:15Z","updated_at":"2016-04-12T20:14:15Z","html_url":"https://github.com/mlpack/mlpack/pull/523#discussion_r59445167","pull_request_url":"https://api.github.com/repos/mlpack/mlpack/pulls/523","_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/59445167"},"html":{"href":"https://github.com/mlpack/mlpack/pull/523#discussion_r59445167"},"pull_request":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/523"}}},"pull_request":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/523","id":60456718,"html_url":"https://github.com/mlpack/mlpack/pull/523","diff_url":"https://github.com/mlpack/mlpack/pull/523.diff","patch_url":"https://github.com/mlpack/mlpack/pull/523.patch","issue_url":"https://api.github.com/repos/mlpack/mlpack/issues/523","number":523,"state":"open","locked":false,"title":"add train test split","user":{"login":"stereomatchingkiss","id":1801914,"avatar_url":"https://avatars.githubusercontent.com/u/1801914?v=3","gravatar_id":"","url":"https://api.github.com/users/stereomatchingkiss","html_url":"https://github.com/stereomatchingkiss","followers_url":"https://api.github.com/users/stereomatchingkiss/followers","following_url":"https://api.github.com/users/stereomatchingkiss/following{/other_user}","gists_url":"https://api.github.com/users/stereomatchingkiss/gists{/gist_id}","starred_url":"https://api.github.com/users/stereomatchingkiss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stereomatchingkiss/subscriptions","organizations_url":"https://api.github.com/users/stereomatchingkiss/orgs","repos_url":"https://api.github.com/users/stereomatchingkiss/repos","events_url":"https://api.github.com/users/stereomatchingkiss/events{/privacy}","received_events_url":"https://api.github.com/users/stereomatchingkiss/received_events","type":"User","site_admin":false},"body":"Add function to split train and test data","created_at":"2016-02-24T05:00:43Z","updated_at":"2016-04-12T20:14:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"085d2ec357471da4000d0308522f7d85948f8c52","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mlpack/mlpack/pulls/523/commits","review_comments_url":"https://api.github.com/repos/mlpack/mlpack/pulls/523/comments","review_comment_url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mlpack/mlpack/issues/523/comments","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/860256202d7cba23dd3500a05e36ecd351f1d673","head":{"label":"stereomatchingkiss:split_data","ref":"split_data","sha":"860256202d7cba23dd3500a05e36ecd351f1d673","user":{"login":"stereomatchingkiss","id":1801914,"avatar_url":"https://avatars.githubusercontent.com/u/1801914?v=3","gravatar_id":"","url":"https://api.github.com/users/stereomatchingkiss","html_url":"https://github.com/stereomatchingkiss","followers_url":"https://api.github.com/users/stereomatchingkiss/followers","following_url":"https://api.github.com/users/stereomatchingkiss/following{/other_user}","gists_url":"https://api.github.com/users/stereomatchingkiss/gists{/gist_id}","starred_url":"https://api.github.com/users/stereomatchingkiss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stereomatchingkiss/subscriptions","organizations_url":"https://api.github.com/users/stereomatchingkiss/orgs","repos_url":"https://api.github.com/users/stereomatchingkiss/repos","events_url":"https://api.github.com/users/stereomatchingkiss/events{/privacy}","received_events_url":"https://api.github.com/users/stereomatchingkiss/received_events","type":"User","site_admin":false},"repo":{"id":42843439,"name":"mlpack","full_name":"stereomatchingkiss/mlpack","owner":{"login":"stereomatchingkiss","id":1801914,"avatar_url":"https://avatars.githubusercontent.com/u/1801914?v=3","gravatar_id":"","url":"https://api.github.com/users/stereomatchingkiss","html_url":"https://github.com/stereomatchingkiss","followers_url":"https://api.github.com/users/stereomatchingkiss/followers","following_url":"https://api.github.com/users/stereomatchingkiss/following{/other_user}","gists_url":"https://api.github.com/users/stereomatchingkiss/gists{/gist_id}","starred_url":"https://api.github.com/users/stereomatchingkiss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stereomatchingkiss/subscriptions","organizations_url":"https://api.github.com/users/stereomatchingkiss/orgs","repos_url":"https://api.github.com/users/stereomatchingkiss/repos","events_url":"https://api.github.com/users/stereomatchingkiss/events{/privacy}","received_events_url":"https://api.github.com/users/stereomatchingkiss/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stereomatchingkiss/mlpack","description":"mlpack: a scalable C++ machine learning library","fork":true,"url":"https://api.github.com/repos/stereomatchingkiss/mlpack","forks_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/forks","keys_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/teams","hooks_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/hooks","issue_events_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/events","assignees_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/tags","blobs_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/languages","stargazers_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/stargazers","contributors_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/contributors","subscribers_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/subscribers","subscription_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/subscription","commits_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/merges","archive_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/downloads","issues_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/stereomatchingkiss/mlpack/deployments","created_at":"2015-09-21T04:14:44Z","updated_at":"2016-01-25T05:22:21Z","pushed_at":"2016-04-12T20:09:11Z","git_url":"git://github.com/stereomatchingkiss/mlpack.git","ssh_url":"git@github.com:stereomatchingkiss/mlpack.git","clone_url":"https://github.com/stereomatchingkiss/mlpack.git","svn_url":"https://github.com/stereomatchingkiss/mlpack","homepage":null,"size":144258,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"mlpack:master","ref":"master","sha":"bb8507c561d5e135ba2a6a168ad9d0d5735fc85b","user":{"login":"mlpack","id":10216045,"avatar_url":"https://avatars.githubusercontent.com/u/10216045?v=3","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"repo":{"id":28149409,"name":"mlpack","full_name":"mlpack/mlpack","owner":{"login":"mlpack","id":10216045,"avatar_url":"https://avatars.githubusercontent.com/u/10216045?v=3","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mlpack/mlpack","description":"mlpack: a scalable C++ machine learning library","fork":false,"url":"https://api.github.com/repos/mlpack/mlpack","forks_url":"https://api.github.com/repos/mlpack/mlpack/forks","keys_url":"https://api.github.com/repos/mlpack/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mlpack/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mlpack/mlpack/teams","hooks_url":"https://api.github.com/repos/mlpack/mlpack/hooks","issue_events_url":"https://api.github.com/repos/mlpack/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/mlpack/mlpack/events","assignees_url":"https://api.github.com/repos/mlpack/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/mlpack/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/mlpack/mlpack/tags","blobs_url":"https://api.github.com/repos/mlpack/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mlpack/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mlpack/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/mlpack/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/mlpack/mlpack/languages","stargazers_url":"https://api.github.com/repos/mlpack/mlpack/stargazers","contributors_url":"https://api.github.com/repos/mlpack/mlpack/contributors","subscribers_url":"https://api.github.com/repos/mlpack/mlpack/subscribers","subscription_url":"https://api.github.com/repos/mlpack/mlpack/subscription","commits_url":"https://api.github.com/repos/mlpack/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/mlpack/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/mlpack/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/mlpack/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/mlpack/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/mlpack/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mlpack/mlpack/merges","archive_url":"https://api.github.com/repos/mlpack/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mlpack/mlpack/downloads","issues_url":"https://api.github.com/repos/mlpack/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/mlpack/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/mlpack/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/mlpack/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mlpack/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/mlpack/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/mlpack/mlpack/deployments","created_at":"2014-12-17T18:16:59Z","updated_at":"2016-04-12T17:25:36Z","pushed_at":"2016-04-12T15:44:27Z","git_url":"git://github.com/mlpack/mlpack.git","ssh_url":"git@github.com:mlpack/mlpack.git","clone_url":"https://github.com/mlpack/mlpack.git","svn_url":"https://github.com/mlpack/mlpack","homepage":null,"size":164461,"stargazers_count":809,"watchers_count":809,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":325,"mirror_url":null,"open_issues_count":68,"forks":325,"open_issues":68,"watchers":809,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/523"},"html":{"href":"https://github.com/mlpack/mlpack/pull/523"},"issue":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/523"},"comments":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/523/comments"},"review_comments":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/523/comments"},"review_comment":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/523/commits"},"statuses":{"href":"https://api.github.com/repos/mlpack/mlpack/statuses/860256202d7cba23dd3500a05e36ecd351f1d673"}}}}