{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/53291441","id":53291441,"diff_hunk":"@@ -264,6 +299,15 @@ def sparse_encode(X, dictionary, gram=None, cov=None, algorithm='lasso_lars',\n         regularization = n_nonzero_coefs\n         if regularization is None:\n             regularization = min(max(n_features / 10, 1), n_components)\n+    elif algorithm == 'elastic_net':\n+        if alpha is None and l1_ratio is None:\n+            regularization = (1., 1.)\n+        elif alpha is not None and l1_ratio is None:\n+            regularization = (alpha, 1.)\n+        elif alpha is None and l1_ratio is not None:\n+            regularization = (1., l1_ratio)\n+        else:\n+            regularization = (alpha, l1_ratio)","path":"sklearn/decomposition/dict_learning.py","position":135,"original_position":135,"commit_id":"4b4cf8fd5ef8e878dd63d069c695ea51866f3f08","original_commit_id":"4b4cf8fd5ef8e878dd63d069c695ea51866f3f08","user":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"body":"This can be tidied:\r\n```python\r\nreg_alpha= 1 if alpha is None else alpha\r\nreg_l1_ratio = 1 if l1_ratio if None else l1_ratio\r\nregularization = (reg_alpha, reg_l1_ratio)\r\n```","created_at":"2016-02-18T09:46:33Z","updated_at":"2016-02-18T09:46:33Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/6382#discussion_r53291441","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6382","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/53291441"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/6382#discussion_r53291441"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6382"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6382","id":59664690,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/6382","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/6382.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/6382.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6382","number":6382,"state":"open","locked":false,"title":"ENH: Add elastic net regularization option for dictionary learning.","user":{"login":"jakirkham","id":3019665,"avatar_url":"https://avatars.githubusercontent.com/u/3019665?v=3","gravatar_id":"","url":"https://api.github.com/users/jakirkham","html_url":"https://github.com/jakirkham","followers_url":"https://api.github.com/users/jakirkham/followers","following_url":"https://api.github.com/users/jakirkham/following{/other_user}","gists_url":"https://api.github.com/users/jakirkham/gists{/gist_id}","starred_url":"https://api.github.com/users/jakirkham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakirkham/subscriptions","organizations_url":"https://api.github.com/users/jakirkham/orgs","repos_url":"https://api.github.com/users/jakirkham/repos","events_url":"https://api.github.com/users/jakirkham/events{/privacy}","received_events_url":"https://api.github.com/users/jakirkham/received_events","type":"User","site_admin":false},"body":"Tries to provide elastic net regularization for dictionary learning. Something that was provided for in Mairal, et al.'s SPAMS.\r\n\r\n**Todo:**\r\n* [X] Provide support for elastic net and its parameter `l1_ratio`.\r\n* [X] API documentation for using elastic net and its `l1_ratio`.\r\n* [X] Raise exception when `l1_ratio` is set incorrectly (when not using elastic net).\r\n* [x] Tests demonstrating the elastic net regularization works correctly.\r\n* [ ] Adjust to handle positive constraints, if merged. ( https://github.com/scikit-learn/scikit-learn/pull/6374 )\r\n* [ ] Updated overview documentation.\r\n* [ ] Release note.","created_at":"2016-02-17T15:57:59Z","updated_at":"2016-02-18T09:46:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5722fbfa2f20aea026f0499fd2ba7b62c30af16","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6382/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6382/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/6382/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/4b4cf8fd5ef8e878dd63d069c695ea51866f3f08","head":{"label":"jakirkham:dict_elastic_net_constrt","ref":"dict_elastic_net_constrt","sha":"4b4cf8fd5ef8e878dd63d069c695ea51866f3f08","user":{"login":"jakirkham","id":3019665,"avatar_url":"https://avatars.githubusercontent.com/u/3019665?v=3","gravatar_id":"","url":"https://api.github.com/users/jakirkham","html_url":"https://github.com/jakirkham","followers_url":"https://api.github.com/users/jakirkham/followers","following_url":"https://api.github.com/users/jakirkham/following{/other_user}","gists_url":"https://api.github.com/users/jakirkham/gists{/gist_id}","starred_url":"https://api.github.com/users/jakirkham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakirkham/subscriptions","organizations_url":"https://api.github.com/users/jakirkham/orgs","repos_url":"https://api.github.com/users/jakirkham/repos","events_url":"https://api.github.com/users/jakirkham/events{/privacy}","received_events_url":"https://api.github.com/users/jakirkham/received_events","type":"User","site_admin":false},"repo":{"id":39590355,"name":"scikit-learn","full_name":"jakirkham/scikit-learn","owner":{"login":"jakirkham","id":3019665,"avatar_url":"https://avatars.githubusercontent.com/u/3019665?v=3","gravatar_id":"","url":"https://api.github.com/users/jakirkham","html_url":"https://github.com/jakirkham","followers_url":"https://api.github.com/users/jakirkham/followers","following_url":"https://api.github.com/users/jakirkham/following{/other_user}","gists_url":"https://api.github.com/users/jakirkham/gists{/gist_id}","starred_url":"https://api.github.com/users/jakirkham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakirkham/subscriptions","organizations_url":"https://api.github.com/users/jakirkham/orgs","repos_url":"https://api.github.com/users/jakirkham/repos","events_url":"https://api.github.com/users/jakirkham/events{/privacy}","received_events_url":"https://api.github.com/users/jakirkham/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jakirkham/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/jakirkham/scikit-learn","forks_url":"https://api.github.com/repos/jakirkham/scikit-learn/forks","keys_url":"https://api.github.com/repos/jakirkham/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jakirkham/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jakirkham/scikit-learn/teams","hooks_url":"https://api.github.com/repos/jakirkham/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/jakirkham/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/jakirkham/scikit-learn/events","assignees_url":"https://api.github.com/repos/jakirkham/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/jakirkham/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/jakirkham/scikit-learn/tags","blobs_url":"https://api.github.com/repos/jakirkham/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jakirkham/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jakirkham/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/jakirkham/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jakirkham/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/jakirkham/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/jakirkham/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/jakirkham/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/jakirkham/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/jakirkham/scikit-learn/subscription","commits_url":"https://api.github.com/repos/jakirkham/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/jakirkham/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/jakirkham/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/jakirkham/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/jakirkham/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/jakirkham/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jakirkham/scikit-learn/merges","archive_url":"https://api.github.com/repos/jakirkham/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jakirkham/scikit-learn/downloads","issues_url":"https://api.github.com/repos/jakirkham/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/jakirkham/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/jakirkham/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/jakirkham/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jakirkham/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/jakirkham/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/jakirkham/scikit-learn/deployments","created_at":"2015-07-23T20:21:38Z","updated_at":"2016-02-08T20:02:41Z","pushed_at":"2016-02-18T03:24:19Z","git_url":"git://github.com/jakirkham/scikit-learn.git","ssh_url":"git@github.com:jakirkham/scikit-learn.git","clone_url":"https://github.com/jakirkham/scikit-learn.git","svn_url":"https://github.com/jakirkham/scikit-learn","homepage":"http://scikit-learn.org","size":66287,"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":"ffafc803662a2c3bc60326c7b97ddfeae3165bc0","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}","deployments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/deployments","created_at":"2010-08-17T09:43:38Z","updated_at":"2016-02-18T09:42:57Z","pushed_at":"2016-02-18T09:14:40Z","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":100596,"stargazers_count":9801,"watchers_count":9801,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5754,"mirror_url":null,"open_issues_count":1062,"forks":5754,"open_issues":1062,"watchers":9801,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6382"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/6382"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6382"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6382/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6382/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/6382/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/4b4cf8fd5ef8e878dd63d069c695ea51866f3f08"}}}}