{"action":"created","comment":{"url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/comments/42748504","id":42748504,"diff_hunk":"@@ -41,42 +41,60 @@ data in *folds* that we use for training and testing::\n     >>> print(scores)\n     [0.93489148580968284, 0.95659432387312182, 0.93989983305509184]\n \n-.. currentmodule:: sklearn.cross_validation\n+.. currentmodule:: sklearn.model_selection\n \n-This is called a :class:`KFold` cross validation\n+This is called a :class:`KFold` cross-validation.\n \n .. _cv_generators_tut:\n \n Cross-validation generators\n =============================\n \n+Scikit-learn has a collection of classes which can be used to generate lists of\n+train/test indices for popular cross-validation strategies.\n \n+They expose a ``split`` method which accepts the input\n+dataset to be split and yields the train/test set indices for each iteration\n+of the chosen cross-validation strategy.\n \n-The code above to split data in train and test sets is tedious to write.\n-Scikit-learn exposes cross-validation generators to generate list\n-of indices for this purpose::\n+This example shows an example usage of the ``split`` method.\n \n-    >>> from sklearn import cross_validation\n-    >>> k_fold = cross_validation.KFold(n=6, n_folds=3)\n-    >>> for train_indices, test_indices in k_fold:\n+    >>> from sklearn.model_selection import KFold, cross_val_score\n+    >>> X = [\"a\", \"a\", \"b\", \"c\", \"c\", \"c\"]\n+    >>> k_fold = KFold(n_folds=3)\n+    >>> for train_indices, test_indices in k_fold.split(X):\n     ...      print('Train: %s | test: %s' % (train_indices, test_indices))\n     Train: [2 3 4 5] | test: [0 1]\n     Train: [0 1 4 5] | test: [2 3]\n     Train: [0 1 2 3] | test: [4 5]\n \n-The cross-validation can then be implemented easily::\n+The cross-validation can then be performed easily::\n \n-    >>> kfold = cross_validation.KFold(len(X_digits), n_folds=3)\n+    >>> kfold = KFold(n_folds=3)\n     >>> [svc.fit(X_digits[train], y_digits[train]).score(X_digits[test], y_digits[test])\n-    ...          for train, test in kfold]\n+    ...          for train, test in k_fold.split(X_digits)]\n     [0.93489148580968284, 0.95659432387312182, 0.93989983305509184]\n \n-To compute the ``score`` method of an estimator, the sklearn exposes\n-a helper function::\n+This can be directly calculated using the ``cross_val_score`` helper. Given an\n+estimator, the cross-validation object and the input dataset, it splits the\n+data into train/test set, trains the estimator using the training set and\n+computes the scores based on the testing set for each iteration of cross-validation.\n \n-    >>> cross_validation.cross_val_score(svc, X_digits, y_digits, cv=kfold, n_jobs=-1)\n+By default the estimator's ``score`` method is used to compute the individual scores.\n+\n+Refer the :ref:`metrics module <metrics>` to learn more on the available scoring\n+methods.\n+\n+    >>> cross_val_score(svc, X_digits, y_digits, cv=k_fold, n_jobs=-1)\n     array([ 0.93489149,  0.95659432,  0.93989983])\n \n+Alternatively the ``scoring`` attribute can be set to specify the required\n+scoring method.\n+\n+    >>> cross_val_score(svc, X_digits, y_digits, cv=k_fold, scoring='mean_squared_error',","path":"doc/tutorial/statistical_inference/model_selection.rst","position":68,"original_position":68,"commit_id":"53c33a607e9d8fb3ecbcca19bfc672a75cc086c3","original_commit_id":"53c33a607e9d8fb3ecbcca19bfc672a75cc086c3","user":{"login":"ogrisel","id":89061,"avatar_url":"https://avatars.githubusercontent.com/u/89061?v=3","gravatar_id":"","url":"https://api.github.com/users/ogrisel","html_url":"https://github.com/ogrisel","followers_url":"https://api.github.com/users/ogrisel/followers","following_url":"https://api.github.com/users/ogrisel/following{/other_user}","gists_url":"https://api.github.com/users/ogrisel/gists{/gist_id}","starred_url":"https://api.github.com/users/ogrisel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogrisel/subscriptions","organizations_url":"https://api.github.com/users/ogrisel/orgs","repos_url":"https://api.github.com/users/ogrisel/repos","events_url":"https://api.github.com/users/ogrisel/events{/privacy}","received_events_url":"https://api.github.com/users/ogrisel/received_events","type":"User","site_admin":false},"body":"Using `mean_squared_error` on a classification problem with integer coded labels is really misleading. Please use a proper classification metric, e.g. `scoring='precision_macro'`.","created_at":"2015-10-22T13:41:32Z","updated_at":"2015-10-22T13:41:32Z","html_url":"https://github.com/rvraghav93/scikit-learn/pull/4#discussion_r42748504","pull_request_url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/comments/42748504"},"html":{"href":"https://github.com/rvraghav93/scikit-learn/pull/4#discussion_r42748504"},"pull_request":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4","id":42408924,"html_url":"https://github.com/rvraghav93/scikit-learn/pull/4","diff_url":"https://github.com/rvraghav93/scikit-learn/pull/4.diff","patch_url":"https://github.com/rvraghav93/scikit-learn/pull/4.patch","issue_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/4","number":4,"state":"open","locked":false,"title":"[MRG] Model selection documentation","user":{"login":"rvraghav93","id":9487348,"avatar_url":"https://avatars.githubusercontent.com/u/9487348?v=3","gravatar_id":"","url":"https://api.github.com/users/rvraghav93","html_url":"https://github.com/rvraghav93","followers_url":"https://api.github.com/users/rvraghav93/followers","following_url":"https://api.github.com/users/rvraghav93/following{/other_user}","gists_url":"https://api.github.com/users/rvraghav93/gists{/gist_id}","starred_url":"https://api.github.com/users/rvraghav93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvraghav93/subscriptions","organizations_url":"https://api.github.com/users/rvraghav93/orgs","repos_url":"https://api.github.com/users/rvraghav93/repos","events_url":"https://api.github.com/users/rvraghav93/events{/privacy}","received_events_url":"https://api.github.com/users/rvraghav93/received_events","type":"User","site_admin":false},"body":"Documentation for the scikit-learn/scikit-learn#4294\r\n\r\nThe build docs are over [here](http://rvraghav93.github.io/doc_builds)\r\n\r\nTODO -\r\n\r\n- [ ] Move `grid_search.rst` to `search.rst`","created_at":"2015-08-13T22:58:17Z","updated_at":"2015-10-22T13:41:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5152ad863c99f52ae688b2f4ae8ca89c34b4ed97","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4/commits","review_comments_url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4/comments","review_comment_url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/4/comments","statuses_url":"https://api.github.com/repos/rvraghav93/scikit-learn/statuses/53c33a607e9d8fb3ecbcca19bfc672a75cc086c3","head":{"label":"rvraghav93:model_selection_documentation","ref":"model_selection_documentation","sha":"53c33a607e9d8fb3ecbcca19bfc672a75cc086c3","user":{"login":"rvraghav93","id":9487348,"avatar_url":"https://avatars.githubusercontent.com/u/9487348?v=3","gravatar_id":"","url":"https://api.github.com/users/rvraghav93","html_url":"https://github.com/rvraghav93","followers_url":"https://api.github.com/users/rvraghav93/followers","following_url":"https://api.github.com/users/rvraghav93/following{/other_user}","gists_url":"https://api.github.com/users/rvraghav93/gists{/gist_id}","starred_url":"https://api.github.com/users/rvraghav93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvraghav93/subscriptions","organizations_url":"https://api.github.com/users/rvraghav93/orgs","repos_url":"https://api.github.com/users/rvraghav93/repos","events_url":"https://api.github.com/users/rvraghav93/events{/privacy}","received_events_url":"https://api.github.com/users/rvraghav93/received_events","type":"User","site_admin":false},"repo":{"id":26038110,"name":"scikit-learn","full_name":"rvraghav93/scikit-learn","owner":{"login":"rvraghav93","id":9487348,"avatar_url":"https://avatars.githubusercontent.com/u/9487348?v=3","gravatar_id":"","url":"https://api.github.com/users/rvraghav93","html_url":"https://github.com/rvraghav93","followers_url":"https://api.github.com/users/rvraghav93/followers","following_url":"https://api.github.com/users/rvraghav93/following{/other_user}","gists_url":"https://api.github.com/users/rvraghav93/gists{/gist_id}","starred_url":"https://api.github.com/users/rvraghav93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvraghav93/subscriptions","organizations_url":"https://api.github.com/users/rvraghav93/orgs","repos_url":"https://api.github.com/users/rvraghav93/repos","events_url":"https://api.github.com/users/rvraghav93/events{/privacy}","received_events_url":"https://api.github.com/users/rvraghav93/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rvraghav93/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/rvraghav93/scikit-learn","forks_url":"https://api.github.com/repos/rvraghav93/scikit-learn/forks","keys_url":"https://api.github.com/repos/rvraghav93/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rvraghav93/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rvraghav93/scikit-learn/teams","hooks_url":"https://api.github.com/repos/rvraghav93/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/rvraghav93/scikit-learn/events","assignees_url":"https://api.github.com/repos/rvraghav93/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/rvraghav93/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/rvraghav93/scikit-learn/tags","blobs_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rvraghav93/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/rvraghav93/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/rvraghav93/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/rvraghav93/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/rvraghav93/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/rvraghav93/scikit-learn/subscription","commits_url":"https://api.github.com/repos/rvraghav93/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/rvraghav93/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/rvraghav93/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/rvraghav93/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rvraghav93/scikit-learn/merges","archive_url":"https://api.github.com/repos/rvraghav93/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rvraghav93/scikit-learn/downloads","issues_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/rvraghav93/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/rvraghav93/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rvraghav93/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/rvraghav93/scikit-learn/releases{/id}","created_at":"2014-11-01T00:56:31Z","updated_at":"2015-05-03T17:08:25Z","pushed_at":"2015-10-22T13:24:28Z","git_url":"git://github.com/rvraghav93/scikit-learn.git","ssh_url":"git@github.com:rvraghav93/scikit-learn.git","clone_url":"https://github.com/rvraghav93/scikit-learn.git","svn_url":"https://github.com/rvraghav93/scikit-learn","homepage":"http://scikit-learn.org","size":88803,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"rvraghav93:model_selection","ref":"model_selection","sha":"b40f307f820647113af2602aa90563e3c1fa19cb","user":{"login":"rvraghav93","id":9487348,"avatar_url":"https://avatars.githubusercontent.com/u/9487348?v=3","gravatar_id":"","url":"https://api.github.com/users/rvraghav93","html_url":"https://github.com/rvraghav93","followers_url":"https://api.github.com/users/rvraghav93/followers","following_url":"https://api.github.com/users/rvraghav93/following{/other_user}","gists_url":"https://api.github.com/users/rvraghav93/gists{/gist_id}","starred_url":"https://api.github.com/users/rvraghav93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvraghav93/subscriptions","organizations_url":"https://api.github.com/users/rvraghav93/orgs","repos_url":"https://api.github.com/users/rvraghav93/repos","events_url":"https://api.github.com/users/rvraghav93/events{/privacy}","received_events_url":"https://api.github.com/users/rvraghav93/received_events","type":"User","site_admin":false},"repo":{"id":26038110,"name":"scikit-learn","full_name":"rvraghav93/scikit-learn","owner":{"login":"rvraghav93","id":9487348,"avatar_url":"https://avatars.githubusercontent.com/u/9487348?v=3","gravatar_id":"","url":"https://api.github.com/users/rvraghav93","html_url":"https://github.com/rvraghav93","followers_url":"https://api.github.com/users/rvraghav93/followers","following_url":"https://api.github.com/users/rvraghav93/following{/other_user}","gists_url":"https://api.github.com/users/rvraghav93/gists{/gist_id}","starred_url":"https://api.github.com/users/rvraghav93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvraghav93/subscriptions","organizations_url":"https://api.github.com/users/rvraghav93/orgs","repos_url":"https://api.github.com/users/rvraghav93/repos","events_url":"https://api.github.com/users/rvraghav93/events{/privacy}","received_events_url":"https://api.github.com/users/rvraghav93/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rvraghav93/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/rvraghav93/scikit-learn","forks_url":"https://api.github.com/repos/rvraghav93/scikit-learn/forks","keys_url":"https://api.github.com/repos/rvraghav93/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rvraghav93/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rvraghav93/scikit-learn/teams","hooks_url":"https://api.github.com/repos/rvraghav93/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/rvraghav93/scikit-learn/events","assignees_url":"https://api.github.com/repos/rvraghav93/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/rvraghav93/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/rvraghav93/scikit-learn/tags","blobs_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rvraghav93/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/rvraghav93/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/rvraghav93/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/rvraghav93/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/rvraghav93/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/rvraghav93/scikit-learn/subscription","commits_url":"https://api.github.com/repos/rvraghav93/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/rvraghav93/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/rvraghav93/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/rvraghav93/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/rvraghav93/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rvraghav93/scikit-learn/merges","archive_url":"https://api.github.com/repos/rvraghav93/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rvraghav93/scikit-learn/downloads","issues_url":"https://api.github.com/repos/rvraghav93/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/rvraghav93/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/rvraghav93/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rvraghav93/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/rvraghav93/scikit-learn/releases{/id}","created_at":"2014-11-01T00:56:31Z","updated_at":"2015-05-03T17:08:25Z","pushed_at":"2015-10-22T13:24:28Z","git_url":"git://github.com/rvraghav93/scikit-learn.git","ssh_url":"git@github.com:rvraghav93/scikit-learn.git","clone_url":"https://github.com/rvraghav93/scikit-learn.git","svn_url":"https://github.com/rvraghav93/scikit-learn","homepage":"http://scikit-learn.org","size":88803,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4"},"html":{"href":"https://github.com/rvraghav93/scikit-learn/pull/4"},"issue":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/4"},"comments":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/rvraghav93/scikit-learn/statuses/53c33a607e9d8fb3ecbcca19bfc672a75cc086c3"}}}}