{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/40174098","id":40174098,"diff_hunk":"@@ -0,0 +1,51 @@\n+\"\"\"\n+===================================================\n+Feature selection using SelectFromModel and LassoCV\n+===================================================\n+\n+Use SelectFromModel meta-transformer along with Lasso to select the best\n+couple of features from the Boston dataset.\n+\"\"\"\n+# Author: Manoj Kumar <mks542@nyu.edu>\n+# License: BSD 3 clause\n+\n+print(__doc__)\n+\n+import matplotlib.pyplot as plt\n+import numpy as np\n+\n+from sklearn.datasets import load_boston\n+from sklearn.feature_selection import SelectFromModel\n+from sklearn.linear_model import LassoCV\n+\n+# Load the boston dataset.\n+boston = load_boston()\n+X, y = boston['data'], boston['target']\n+\n+# We use the base estimator LassoCV since the L1 norm promotes sparsity of features.\n+clf = LassoCV()\n+\n+# Set a minimum threshold of 0.25\n+sfm = SelectFromModel(clf, threshold=0.25)\n+sfm.fit(X, y)\n+n_features = sfm.transform(X).shape[1]\n+\n+# Reset the threshold till the number of features equals two.\n+# Note that the attribute can be set directly instead of repeatedly\n+# fitting the metatransformer.\n+while n_features > 2:\n+\tsfm.threshold += 0.1\n+\tX_transform = sfm.transform(X)\n+\tn_features = X_transform.shape[1]","path":"examples/feature_selection/plot_select_from_model_boston.py","position":39,"original_position":39,"commit_id":"3d5dddcb806aa97c17fd431d90d4008a207e427a","original_commit_id":"3d5dddcb806aa97c17fd431d90d4008a207e427a","user":{"login":"glouppe","id":477771,"avatar_url":"https://avatars.githubusercontent.com/u/477771?v=3","gravatar_id":"","url":"https://api.github.com/users/glouppe","html_url":"https://github.com/glouppe","followers_url":"https://api.github.com/users/glouppe/followers","following_url":"https://api.github.com/users/glouppe/following{/other_user}","gists_url":"https://api.github.com/users/glouppe/gists{/gist_id}","starred_url":"https://api.github.com/users/glouppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glouppe/subscriptions","organizations_url":"https://api.github.com/users/glouppe/orgs","repos_url":"https://api.github.com/users/glouppe/repos","events_url":"https://api.github.com/users/glouppe/events{/privacy}","received_events_url":"https://api.github.com/users/glouppe/received_events","type":"User","site_admin":false},"body":"Use spaces instead of tabs","created_at":"2015-09-23T06:31:53Z","updated_at":"2015-09-23T06:31:53Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4242#discussion_r40174098","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/40174098"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/4242#discussion_r40174098"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242","id":29165701,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/4242","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/4242.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/4242.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4242","number":4242,"state":"open","locked":false,"title":"[MRG] Implemented SelectFromModel meta-transformer","user":{"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},"body":"Continuation of https://github.com/scikit-learn/scikit-learn/pull/3011/","created_at":"2015-02-12T10:00:37Z","updated_at":"2015-09-23T06:31:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7660258001e2e76382b4595be67c858ed70122e0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242/comments","review_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4242/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/3d5dddcb806aa97c17fd431d90d4008a207e427a","head":{"label":"MechCoder:select_from_model","ref":"select_from_model","sha":"3d5dddcb806aa97c17fd431d90d4008a207e427a","user":{"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},"repo":{"id":9655682,"name":"scikit-learn","full_name":"MechCoder/scikit-learn","owner":{"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},"private":false,"html_url":"https://github.com/MechCoder/scikit-learn","description":"Work in Progress","fork":true,"url":"https://api.github.com/repos/MechCoder/scikit-learn","forks_url":"https://api.github.com/repos/MechCoder/scikit-learn/forks","keys_url":"https://api.github.com/repos/MechCoder/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MechCoder/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MechCoder/scikit-learn/teams","hooks_url":"https://api.github.com/repos/MechCoder/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/MechCoder/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/MechCoder/scikit-learn/events","assignees_url":"https://api.github.com/repos/MechCoder/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/MechCoder/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/MechCoder/scikit-learn/tags","blobs_url":"https://api.github.com/repos/MechCoder/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MechCoder/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MechCoder/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/MechCoder/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MechCoder/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/MechCoder/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/MechCoder/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/MechCoder/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/MechCoder/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/MechCoder/scikit-learn/subscription","commits_url":"https://api.github.com/repos/MechCoder/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/MechCoder/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/MechCoder/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/MechCoder/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/MechCoder/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/MechCoder/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MechCoder/scikit-learn/merges","archive_url":"https://api.github.com/repos/MechCoder/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MechCoder/scikit-learn/downloads","issues_url":"https://api.github.com/repos/MechCoder/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/MechCoder/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/MechCoder/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/MechCoder/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MechCoder/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/MechCoder/scikit-learn/releases{/id}","created_at":"2013-04-24T19:16:18Z","updated_at":"2015-04-08T11:06:14Z","pushed_at":"2015-09-22T21:26:16Z","git_url":"git://github.com/MechCoder/scikit-learn.git","ssh_url":"git@github.com:MechCoder/scikit-learn.git","clone_url":"https://github.com/MechCoder/scikit-learn.git","svn_url":"https://github.com/MechCoder/scikit-learn","homepage":"http://scikit-learn.org","size":67458,"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-learn:master","ref":"master","sha":"2a5652a3d8ae5fb295679b43a3e81a633d4ef48c","user":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"repo":{"id":843222,"name":"scikit-learn","full_name":"scikit-learn/scikit-learn","owner":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-learn/scikit-learn","description":"scikit-learn: machine learning in Python","fork":false,"url":"https://api.github.com/repos/scikit-learn/scikit-learn","forks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/forks","keys_url":"https://api.github.com/repos/scikit-learn/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-learn/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-learn/scikit-learn/teams","hooks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/events","assignees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-learn/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/tags","blobs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-learn/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscription","commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-learn/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-learn/scikit-learn/merges","archive_url":"https://api.github.com/repos/scikit-learn/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-learn/scikit-learn/downloads","issues_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-learn/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/scikit-learn/scikit-learn/releases{/id}","created_at":"2010-08-17T09:43:38Z","updated_at":"2015-09-23T04:31:42Z","pushed_at":"2015-09-23T00:27:29Z","git_url":"git://github.com/scikit-learn/scikit-learn.git","ssh_url":"git@github.com:scikit-learn/scikit-learn.git","clone_url":"https://github.com/scikit-learn/scikit-learn.git","svn_url":"https://github.com/scikit-learn/scikit-learn","homepage":"http://scikit-learn.org","size":133271,"stargazers_count":7599,"watchers_count":7599,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4492,"mirror_url":null,"open_issues_count":749,"forks":4492,"open_issues":749,"watchers":7599,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/4242"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4242"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4242/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4242/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/3d5dddcb806aa97c17fd431d90d4008a207e427a"}}}}