{"action":"created","comment":{"url":"https://api.github.com/repos/mblondel/lightning/pulls/comments/43880393","id":43880393,"diff_hunk":"@@ -19,6 +20,40 @@ from lightning.impl.dataset_fast cimport RowDataset\n from lightning.impl.sgd_fast cimport LossFunction\n \n \n+cdef class ProxFunction:\n+\n+    cdef void apply_prox(self, double* x, int x_size):\n+        raise NotImplementedError()\n+\n+\n+cdef class L1Prox(ProxFunction):\n+\n+    cdef double l1\n+\n+    def __init__(self, double l1=0.):\n+        self.l1 = l1\n+\n+    cdef void apply_prox(self, double* x, int x_size):\n+        cdef int j\n+        for j in xrange(x_size):\n+            x[j] = np.sign(x[j]) * np.abs(x[j] - self.l1) * (np.abs(x[j]) > self.l1)\n+        return\n+\n+\n+cdef class L2Prox(ProxFunction):","path":"lightning/impl/sag_fast.pyx","position":null,"original_position":32,"commit_id":"dcb1a2c8f8a0dd8f6a08d92fc1d57b3526760331","original_commit_id":"ed25e496e42803147e3f19cd5790faf10f9865f9","user":{"login":"zermelozf","id":971180,"avatar_url":"https://avatars.githubusercontent.com/u/971180?v=3","gravatar_id":"","url":"https://api.github.com/users/zermelozf","html_url":"https://github.com/zermelozf","followers_url":"https://api.github.com/users/zermelozf/followers","following_url":"https://api.github.com/users/zermelozf/following{/other_user}","gists_url":"https://api.github.com/users/zermelozf/gists{/gist_id}","starred_url":"https://api.github.com/users/zermelozf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zermelozf/subscriptions","organizations_url":"https://api.github.com/users/zermelozf/orgs","repos_url":"https://api.github.com/users/zermelozf/repos","events_url":"https://api.github.com/users/zermelozf/events{/privacy}","received_events_url":"https://api.github.com/users/zermelozf/received_events","type":"User","site_admin":false},"body":"I removed it now.","created_at":"2015-11-04T13:37:20Z","updated_at":"2015-11-04T13:37:20Z","html_url":"https://github.com/mblondel/lightning/pull/38#discussion_r43880393","pull_request_url":"https://api.github.com/repos/mblondel/lightning/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/mblondel/lightning/pulls/comments/43880393"},"html":{"href":"https://github.com/mblondel/lightning/pull/38#discussion_r43880393"},"pull_request":{"href":"https://api.github.com/repos/mblondel/lightning/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/mblondel/lightning/pulls/38","id":49591779,"html_url":"https://github.com/mblondel/lightning/pull/38","diff_url":"https://github.com/mblondel/lightning/pull/38.diff","patch_url":"https://github.com/mblondel/lightning/pull/38.patch","issue_url":"https://api.github.com/repos/mblondel/lightning/issues/38","number":38,"state":"open","locked":false,"title":"[WIP] Adding prox capability to SAGA.","user":{"login":"zermelozf","id":971180,"avatar_url":"https://avatars.githubusercontent.com/u/971180?v=3","gravatar_id":"","url":"https://api.github.com/users/zermelozf","html_url":"https://github.com/zermelozf","followers_url":"https://api.github.com/users/zermelozf/followers","following_url":"https://api.github.com/users/zermelozf/following{/other_user}","gists_url":"https://api.github.com/users/zermelozf/gists{/gist_id}","starred_url":"https://api.github.com/users/zermelozf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zermelozf/subscriptions","organizations_url":"https://api.github.com/users/zermelozf/orgs","repos_url":"https://api.github.com/users/zermelozf/repos","events_url":"https://api.github.com/users/zermelozf/events{/privacy}","received_events_url":"https://api.github.com/users/zermelozf/received_events","type":"User","site_admin":false},"body":"Continuing #37 after discussing with @fabianp. Added prox capability in `_sag_fit` of file `lightning/impl/sag_fast.pyx` where @fabianp left room for it.\r\n\r\nThe proximity operator is currently specified when a classifier/regressor is built with the `prox` keyword (type `ProxFunction` mimicking `LossFunction` in `lightning/impl/sgd_fast.pyx`). Not sure this is the best way to specify it by default...\r\n\r\n*Notes*\r\nprox implementation breaks sparse updates and the code is excruciatingly slow on `sklearn.datasets.fetch_20newsgroups_vectorized` (cf. [this gist](https://gist.github.com/zermelozf/d4670d6cffea09f6e6f3))\r\n\r\n- [x] Draf of proximity operators.\r\n- [ ] Need to add tests.\r\n- [ ] Add sparsity in L1\r\n- [ ] Profiling","created_at":"2015-11-03T18:21:06Z","updated_at":"2015-11-04T13:37:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7130cc753e0e73d7a3dbe8a749cff9f5ed92f3f0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mblondel/lightning/pulls/38/commits","review_comments_url":"https://api.github.com/repos/mblondel/lightning/pulls/38/comments","review_comment_url":"https://api.github.com/repos/mblondel/lightning/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mblondel/lightning/issues/38/comments","statuses_url":"https://api.github.com/repos/mblondel/lightning/statuses/dcb1a2c8f8a0dd8f6a08d92fc1d57b3526760331","head":{"label":"zermelozf:fabianp-saga","ref":"fabianp-saga","sha":"dcb1a2c8f8a0dd8f6a08d92fc1d57b3526760331","user":{"login":"zermelozf","id":971180,"avatar_url":"https://avatars.githubusercontent.com/u/971180?v=3","gravatar_id":"","url":"https://api.github.com/users/zermelozf","html_url":"https://github.com/zermelozf","followers_url":"https://api.github.com/users/zermelozf/followers","following_url":"https://api.github.com/users/zermelozf/following{/other_user}","gists_url":"https://api.github.com/users/zermelozf/gists{/gist_id}","starred_url":"https://api.github.com/users/zermelozf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zermelozf/subscriptions","organizations_url":"https://api.github.com/users/zermelozf/orgs","repos_url":"https://api.github.com/users/zermelozf/repos","events_url":"https://api.github.com/users/zermelozf/events{/privacy}","received_events_url":"https://api.github.com/users/zermelozf/received_events","type":"User","site_admin":false},"repo":{"id":45188602,"name":"lightning","full_name":"zermelozf/lightning","owner":{"login":"zermelozf","id":971180,"avatar_url":"https://avatars.githubusercontent.com/u/971180?v=3","gravatar_id":"","url":"https://api.github.com/users/zermelozf","html_url":"https://github.com/zermelozf","followers_url":"https://api.github.com/users/zermelozf/followers","following_url":"https://api.github.com/users/zermelozf/following{/other_user}","gists_url":"https://api.github.com/users/zermelozf/gists{/gist_id}","starred_url":"https://api.github.com/users/zermelozf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zermelozf/subscriptions","organizations_url":"https://api.github.com/users/zermelozf/orgs","repos_url":"https://api.github.com/users/zermelozf/repos","events_url":"https://api.github.com/users/zermelozf/events{/privacy}","received_events_url":"https://api.github.com/users/zermelozf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zermelozf/lightning","description":"Large-scale linear classification, regression and ranking in Python","fork":true,"url":"https://api.github.com/repos/zermelozf/lightning","forks_url":"https://api.github.com/repos/zermelozf/lightning/forks","keys_url":"https://api.github.com/repos/zermelozf/lightning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zermelozf/lightning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zermelozf/lightning/teams","hooks_url":"https://api.github.com/repos/zermelozf/lightning/hooks","issue_events_url":"https://api.github.com/repos/zermelozf/lightning/issues/events{/number}","events_url":"https://api.github.com/repos/zermelozf/lightning/events","assignees_url":"https://api.github.com/repos/zermelozf/lightning/assignees{/user}","branches_url":"https://api.github.com/repos/zermelozf/lightning/branches{/branch}","tags_url":"https://api.github.com/repos/zermelozf/lightning/tags","blobs_url":"https://api.github.com/repos/zermelozf/lightning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zermelozf/lightning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zermelozf/lightning/git/refs{/sha}","trees_url":"https://api.github.com/repos/zermelozf/lightning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zermelozf/lightning/statuses/{sha}","languages_url":"https://api.github.com/repos/zermelozf/lightning/languages","stargazers_url":"https://api.github.com/repos/zermelozf/lightning/stargazers","contributors_url":"https://api.github.com/repos/zermelozf/lightning/contributors","subscribers_url":"https://api.github.com/repos/zermelozf/lightning/subscribers","subscription_url":"https://api.github.com/repos/zermelozf/lightning/subscription","commits_url":"https://api.github.com/repos/zermelozf/lightning/commits{/sha}","git_commits_url":"https://api.github.com/repos/zermelozf/lightning/git/commits{/sha}","comments_url":"https://api.github.com/repos/zermelozf/lightning/comments{/number}","issue_comment_url":"https://api.github.com/repos/zermelozf/lightning/issues/comments{/number}","contents_url":"https://api.github.com/repos/zermelozf/lightning/contents/{+path}","compare_url":"https://api.github.com/repos/zermelozf/lightning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zermelozf/lightning/merges","archive_url":"https://api.github.com/repos/zermelozf/lightning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zermelozf/lightning/downloads","issues_url":"https://api.github.com/repos/zermelozf/lightning/issues{/number}","pulls_url":"https://api.github.com/repos/zermelozf/lightning/pulls{/number}","milestones_url":"https://api.github.com/repos/zermelozf/lightning/milestones{/number}","notifications_url":"https://api.github.com/repos/zermelozf/lightning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zermelozf/lightning/labels{/name}","releases_url":"https://api.github.com/repos/zermelozf/lightning/releases{/id}","created_at":"2015-10-29T14:33:00Z","updated_at":"2015-10-29T14:33:01Z","pushed_at":"2015-11-04T13:36:44Z","git_url":"git://github.com/zermelozf/lightning.git","ssh_url":"git@github.com:zermelozf/lightning.git","clone_url":"https://github.com/zermelozf/lightning.git","svn_url":"https://github.com/zermelozf/lightning","homepage":"http://www.mblondel.org/lightning/","size":2039,"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":"mblondel:master","ref":"master","sha":"c92137f2942d5289eb7b82ac8a09fa65e9c6e880","user":{"login":"mblondel","id":233706,"avatar_url":"https://avatars.githubusercontent.com/u/233706?v=3","gravatar_id":"","url":"https://api.github.com/users/mblondel","html_url":"https://github.com/mblondel","followers_url":"https://api.github.com/users/mblondel/followers","following_url":"https://api.github.com/users/mblondel/following{/other_user}","gists_url":"https://api.github.com/users/mblondel/gists{/gist_id}","starred_url":"https://api.github.com/users/mblondel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mblondel/subscriptions","organizations_url":"https://api.github.com/users/mblondel/orgs","repos_url":"https://api.github.com/users/mblondel/repos","events_url":"https://api.github.com/users/mblondel/events{/privacy}","received_events_url":"https://api.github.com/users/mblondel/received_events","type":"User","site_admin":false},"repo":{"id":3153959,"name":"lightning","full_name":"mblondel/lightning","owner":{"login":"mblondel","id":233706,"avatar_url":"https://avatars.githubusercontent.com/u/233706?v=3","gravatar_id":"","url":"https://api.github.com/users/mblondel","html_url":"https://github.com/mblondel","followers_url":"https://api.github.com/users/mblondel/followers","following_url":"https://api.github.com/users/mblondel/following{/other_user}","gists_url":"https://api.github.com/users/mblondel/gists{/gist_id}","starred_url":"https://api.github.com/users/mblondel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mblondel/subscriptions","organizations_url":"https://api.github.com/users/mblondel/orgs","repos_url":"https://api.github.com/users/mblondel/repos","events_url":"https://api.github.com/users/mblondel/events{/privacy}","received_events_url":"https://api.github.com/users/mblondel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mblondel/lightning","description":"Large-scale linear classification, regression and ranking in Python","fork":false,"url":"https://api.github.com/repos/mblondel/lightning","forks_url":"https://api.github.com/repos/mblondel/lightning/forks","keys_url":"https://api.github.com/repos/mblondel/lightning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mblondel/lightning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mblondel/lightning/teams","hooks_url":"https://api.github.com/repos/mblondel/lightning/hooks","issue_events_url":"https://api.github.com/repos/mblondel/lightning/issues/events{/number}","events_url":"https://api.github.com/repos/mblondel/lightning/events","assignees_url":"https://api.github.com/repos/mblondel/lightning/assignees{/user}","branches_url":"https://api.github.com/repos/mblondel/lightning/branches{/branch}","tags_url":"https://api.github.com/repos/mblondel/lightning/tags","blobs_url":"https://api.github.com/repos/mblondel/lightning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mblondel/lightning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mblondel/lightning/git/refs{/sha}","trees_url":"https://api.github.com/repos/mblondel/lightning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mblondel/lightning/statuses/{sha}","languages_url":"https://api.github.com/repos/mblondel/lightning/languages","stargazers_url":"https://api.github.com/repos/mblondel/lightning/stargazers","contributors_url":"https://api.github.com/repos/mblondel/lightning/contributors","subscribers_url":"https://api.github.com/repos/mblondel/lightning/subscribers","subscription_url":"https://api.github.com/repos/mblondel/lightning/subscription","commits_url":"https://api.github.com/repos/mblondel/lightning/commits{/sha}","git_commits_url":"https://api.github.com/repos/mblondel/lightning/git/commits{/sha}","comments_url":"https://api.github.com/repos/mblondel/lightning/comments{/number}","issue_comment_url":"https://api.github.com/repos/mblondel/lightning/issues/comments{/number}","contents_url":"https://api.github.com/repos/mblondel/lightning/contents/{+path}","compare_url":"https://api.github.com/repos/mblondel/lightning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mblondel/lightning/merges","archive_url":"https://api.github.com/repos/mblondel/lightning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mblondel/lightning/downloads","issues_url":"https://api.github.com/repos/mblondel/lightning/issues{/number}","pulls_url":"https://api.github.com/repos/mblondel/lightning/pulls{/number}","milestones_url":"https://api.github.com/repos/mblondel/lightning/milestones{/number}","notifications_url":"https://api.github.com/repos/mblondel/lightning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mblondel/lightning/labels{/name}","releases_url":"https://api.github.com/repos/mblondel/lightning/releases{/id}","created_at":"2012-01-11T13:53:52Z","updated_at":"2015-10-22T16:57:09Z","pushed_at":"2015-11-04T13:36:44Z","git_url":"git://github.com/mblondel/lightning.git","ssh_url":"git@github.com:mblondel/lightning.git","clone_url":"https://github.com/mblondel/lightning.git","svn_url":"https://github.com/mblondel/lightning","homepage":"http://www.mblondel.org/lightning/","size":2687,"stargazers_count":202,"watchers_count":202,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":14,"forks":35,"open_issues":14,"watchers":202,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mblondel/lightning/pulls/38"},"html":{"href":"https://github.com/mblondel/lightning/pull/38"},"issue":{"href":"https://api.github.com/repos/mblondel/lightning/issues/38"},"comments":{"href":"https://api.github.com/repos/mblondel/lightning/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/mblondel/lightning/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/mblondel/lightning/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mblondel/lightning/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/mblondel/lightning/statuses/dcb1a2c8f8a0dd8f6a08d92fc1d57b3526760331"}}}}