{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4738","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4738/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4738/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4738/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4738","id":78080071,"number":4738,"title":"[MRG+1] Adding Implementation of SAG - next episode","user":{"login":"TomDLT","id":11065596,"avatar_url":"https://avatars.githubusercontent.com/u/11065596?v=3","gravatar_id":"","url":"https://api.github.com/users/TomDLT","html_url":"https://github.com/TomDLT","followers_url":"https://api.github.com/users/TomDLT/followers","following_url":"https://api.github.com/users/TomDLT/following{/other_user}","gists_url":"https://api.github.com/users/TomDLT/gists{/gist_id}","starred_url":"https://api.github.com/users/TomDLT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomDLT/subscriptions","organizations_url":"https://api.github.com/users/TomDLT/orgs","repos_url":"https://api.github.com/users/TomDLT/repos","events_url":"https://api.github.com/users/TomDLT/events{/privacy}","received_events_url":"https://api.github.com/users/TomDLT/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":70,"created_at":"2015-05-19T13:09:21Z","updated_at":"2015-07-01T18:16:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4738","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4738","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/4738.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/4738.patch"},"body":"I took over the great work of @dsullivan7 in #3814.\r\n\r\nI removed the merges with master, squashed all the commits and rebased on master."},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/117779781","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4738#issuecomment-117779781","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4738","id":117779781,"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},"created_at":"2015-07-01T18:16:33Z","updated_at":"2015-07-01T18:16:33Z","body":"As we release the GIL in the Cython sag solver, we can leverage the threading backed of joblib for that solver.\r\n\r\nIn the fit method of `LogisticRegressionCV` we can do:\r\n\r\n```python\r\n        # The SAG solver releases the GIL so it's more efficient to use\r\n        # threads for this solver.\r\n        backend = 'threading' if self.solver == 'sag' else 'multiprocessing'\r\n        fold_coefs_ = Parallel(n_jobs=self.n_jobs, verbose=self.verbose,\r\n                                  baclend=backend)(\r\n            path_func(X, y, train, test, pos_class=label, Cs=self.Cs,\r\n                      fit_intercept=self.fit_intercept, penalty=self.penalty,\r\n                      dual=self.dual, solver=self.solver, tol=self.tol,\r\n                      max_iter=self.max_iter, verbose=self.verbose,\r\n                      class_weight=self.class_weight, scoring=self.scoring,\r\n                      multi_class=self.multi_class,\r\n                      intercept_scaling=self.intercept_scaling\r\n                      )\r\n            for label in iter_labels\r\n            for train, test in folds)\r\n```\r\n\r\nAlso the in the `fit` method of the `LogisticRegression` class, the following loop could be similarly joblib'ed:\r\n\r\n```python\r\n        for ind, class_ in enumerate(classes_):\r\n            coef_, _ = logistic_regression_path(\r\n                X, y, pos_class=class_, Cs=[self.C],\r\n                fit_intercept=self.fit_intercept, tol=self.tol,\r\n                verbose=self.verbose, solver=self.solver,\r\n                multi_class=self.multi_class, max_iter=self.max_iter,\r\n                class_weight=self.class_weight)\r\n            self.coef_.append(coef_[0])\r\n```"}}