Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ENH Enable the "sufficient stats" mode of LARS #11699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 66 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
285cd35
check in changes
yukuairoy Jun 15, 2018
866d29a
now the test passes
yukuairoy Jun 15, 2018
37abbcf
fix lasso add tests
yukuairoy Jul 25, 2018
6cb2543
Use single quotes instead of double quotes
yukuairoy Jul 25, 2018
a45c92b
Add more sufficient stats tests
yukuairoy Jul 26, 2018
7c2f8a5
Merge branch 'master' into least-angle
yukuairoy Jul 27, 2018
401d925
Merge branch 'master' into least-angle
yukuairoy Jul 27, 2018
743aa98
merge conflict
yukuairoy Jul 28, 2018
b365678
fix test
yukuairoy Jul 28, 2018
3617030
style changes
yukuairoy Jul 28, 2018
709afd0
style fixes
yukuairoy Jul 29, 2018
4ffbd99
Merge branch 'master' of github.com:yukuairoy/scikit-learn into least…
yukuairoy Jul 29, 2018
78dada6
revert style changes
yukuairoy Jul 29, 2018
b67f67b
remove unused rng in test_least_angle
yukuairoy Jul 30, 2018
7413722
Merge branch 'master' of git://github.com/scikit-learn/scikit-learn i…
yukuairoy Jul 30, 2018
843cbaa
small improvement
yukuairoy Jul 30, 2018
3534084
Merge branch 'master' of git://github.com/scikit-learn/scikit-learn
yukuairoy Aug 4, 2018
1d7e1ba
merge
yukuairoy Aug 15, 2018
f72e147
Merge branch 'master' into least-angle
yukuairoy Aug 15, 2018
3a6f4ef
Merge branch 'master' of git://github.com/scikit-learn/scikit-learn i…
yukuairoy Aug 19, 2018
a3b969f
Merge branch 'master' of git://github.com/scikit-learn/scikit-learn i…
yukuairoy Aug 26, 2018
c51a313
API Changes
yukuairoy Aug 26, 2018
19157cc
indentation
yukuairoy Aug 26, 2018
c127489
indentation
yukuairoy Aug 26, 2018
aff41db
add lars_path_gram
yukuairoy Aug 27, 2018
491cf7e
rename _lars_path to _lars_path_solver
yukuairoy Aug 29, 2018
ae60560
Merge branch 'master' of git://github.com/scikit-learn/scikit-learn i…
yukuairoy Aug 29, 2018
41f92f3
fix indentation
yukuairoy Aug 30, 2018
fd38ace
indentation fix
yukuairoy Aug 30, 2018
9e72861
Merge branch 'master' of git://github.com/scikit-learn/scikit-learn i…
yukuairoy Sep 24, 2018
dfb6ef7
Code review feedback addressed
yukuairoy Sep 24, 2018
98e30cc
Merge branch 'least-angle' of github.com:yukuairoy/scikit-learn into …
yukuairoy Sep 24, 2018
ccbba52
deprecatewarning
yukuairoy Sep 24, 2018
923962f
fix
yukuairoy Sep 24, 2018
7f4320e
fix
yukuairoy Sep 24, 2018
5459d8d
rebase and code review feedback
yukuairoy Oct 7, 2018
1591557
sync
yukuairoy Oct 7, 2018
b71aa7a
style change
yukuairoy Oct 7, 2018
1de63e9
Merge branch 'master' of git://github.com/scikit-learn/scikit-learn i…
yukuairoy Oct 29, 2018
489ee83
Merge branch 'master' of https://github.com/scikit-learn/scikit-learn…
Nov 5, 2018
71d1c95
Code review changes
Nov 14, 2018
6e7bb76
rebase
yukuairoy Nov 14, 2018
0e0ccb3
resolve merge conflicts
yukuairoy Nov 14, 2018
cd3f8f9
resolve merge conflicts
yukuairoy Nov 14, 2018
9b38b5e
remove tab
yukuairoy Nov 16, 2018
1166080
sync
yukuairoy Nov 30, 2018
c863d0a
Merge branch 'master' of https://github.com/scikit-learn/scikit-learn…
yukuairoy Nov 30, 2018
c12c438
sync
yukuairoy Nov 30, 2018
a522fe2
fix style
yukuairoy Nov 30, 2018
fa53c04
fix style
yukuairoy Dec 2, 2018
a87d0dc
Merge branch 'master' of https://github.com/scikit-learn/scikit-learn…
yukuairoy Jan 3, 2019
ee4ec9b
remove duplicate
yukuairoy Jan 3, 2019
8185b2e
Fix tests
yukuairoy Jan 5, 2019
5a862c3
doc fix
yukuairoy Jan 5, 2019
f0f2705
fix flake8
yukuairoy Jan 5, 2019
6084471
Merge branch 'master' of https://github.com/scikit-learn/scikit-learn…
yukuairoy Jan 5, 2019
a71a1ca
delete duplicate
yukuairoy Jan 5, 2019
18a0f0b
Use assert_allclose instead of assert_array_equal
yukuairoy Jan 8, 2019
abb1186
pull in latest changes
yukuairoy Jan 8, 2019
641af97
fix
yukuairoy Jan 8, 2019
9112bbc
Merge branch 'master' of https://github.com/scikit-learn/scikit-learn…
yukuairoy Mar 4, 2019
965a0e6
Modified what_new
yukuairoy Mar 4, 2019
73bb5e9
Merge branch 'master' of https://github.com/scikit-learn/scikit-learn…
yukuairoy Mar 5, 2019
4687d45
Fix docstring style
yukuairoy Mar 5, 2019
9f1a45e
Merge
yukuairoy Mar 6, 2019
34965c1
Update v0.21.rst
jnothman Mar 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmarks/bench_plot_lasso_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import numpy as np

from sklearn.linear_model import lars_path
from sklearn.linear_model import lars_path, lars_path_gram
from sklearn.linear_model import lasso_path
from sklearn.datasets.samples_generator import make_regression

Expand Down Expand Up @@ -45,7 +45,7 @@ def compute_bench(samples_range, features_range):
tstart = time()
G = np.dot(X.T, X) # precomputed Gram matrix
Xy = np.dot(X.T, y)
lars_path(X, y, Xy=Xy, Gram=G, method='lasso')
lars_path_gram(Xy=Xy, Gram=G, n_samples=y.size, method='lasso')
delta = time() - tstart
print("%0.3fs" % delta)
results['lars_path (with Gram)'].append(delta)
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/bench_plot_omp_lars.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import numpy as np

from sklearn.linear_model import lars_path, orthogonal_mp
from sklearn.linear_model import lars_path, lars_path_gram, orthogonal_mp
from sklearn.datasets.samples_generator import make_sparse_coded_signal


Expand Down Expand Up @@ -58,7 +58,8 @@ def compute_bench(samples_range, features_range):
tstart = time()
G = np.dot(X.T, X) # precomputed Gram matrix
Xy = np.dot(X.T, y)
lars_path(X, y, Xy=Xy, Gram=G, max_iter=n_informative)
lars_path_gram(Xy=Xy, Gram=G, n_samples=y.size,
max_iter=n_informative)
delta = time() - tstart
print("%0.3fs" % delta)
lars_gram[i_f, i_s] = delta
Expand Down
1 change: 1 addition & 0 deletions doc/modules/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ Kernels:

linear_model.enet_path
linear_model.lars_path
linear_model.lars_path_gram
linear_model.lasso_path
linear_model.orthogonal_mp
linear_model.orthogonal_mp_gram
Expand Down
5 changes: 3 additions & 2 deletions doc/modules/linear_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ The disadvantages of the LARS method include:
Statistics article.

The LARS model can be used using estimator :class:`Lars`, or its
low-level implementation :func:`lars_path`.
low-level implementation :func:`lars_path` or :func:`lars_path_gram`.


LARS Lasso
Expand Down Expand Up @@ -489,7 +489,8 @@ function of the norm of its coefficients.

The Lars algorithm provides the full path of the coefficients along
the regularization parameter almost for free, thus a common operation
consist of retrieving the path with function :func:`lars_path`
consist of retrieving the path with function :func:`lars_path` or
:func:`lars_path_gram`

Mathematical formulation
------------------------
Expand Down
25 changes: 17 additions & 8 deletions doc/whats_new/v0.21.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ Support for Python 3.4 and below has been officially dropped.
:class:`linear_model.LogisticRegressionCV` now support Elastic-Net penalty,
with the 'saga' solver. :issue:`11646` by :user:`Nicolas Hug <NicolasHug>`.

- |Feature| Added :class:`linear_model.lars_path_gram`, which is
:class:`linear_model.lars_path` in the sufficient stats mode, allowing
users to compute :class:`linear_model.lars_path` without providing
``X`` and ``y``. :issue:`11699` by :user:`Kuai Yu <yukuairoy>`.

- |Enhancement| :class:`linear_model.make_dataset` now preserves
``float32`` and ``float64`` dtypes. :issue:`8769` and :issue:`11000` by
:user:`Nelle Varoquaux <NelleV>`, :user:`Arthur Imbert <Henley13>`,
Expand All @@ -206,6 +211,10 @@ Support for Python 3.4 and below has been officially dropped.
by the liblinear solver. :issue:`12860` by :user:`Nicolas Hug
<NicolasHug>`.

- |Enhancement| `sparse_cg` solver in :class:`linear_model.ridge.Ridge`
now supports fitting the intercept (i.e. ``fit_intercept=True``) when
inputs are sparse. :issue:`13336` by :user:`Bartosz Telenczuk <btel>`.

- |Fix| Fixed a bug in :class:`linear_model.LogisticRegression` and
:class:`linear_model.LogisticRegressionCV` with 'saga' solver, where the
weights would not be correctly updated in some cases.
Expand All @@ -230,18 +239,18 @@ Support for Python 3.4 and below has been officially dropped.
``fit_intercept=True`` in sparse and dense case.
:issue:`13279` by `Alexandre Gramfort`_

- |API| :func:`linear_model.logistic_regression_path` is deprecated
in version 0.21 and will be removed in version 0.23.
:issue:`12821` by :user:`Nicolas Hug <NicolasHug>`.

- |Enhancement| `sparse_cg` solver in :class:`linear_model.ridge.Ridge`
now supports fitting the intercept (i.e. ``fit_intercept=True``) when
inputs are sparse . :issue:`13336` by :user:`Bartosz Telenczuk <btel>`

- |Fix| Fixed a bug in :class:`linear_model.HuberRegressor` that was
broken when X was of dtype bool.
:issue:`13328` by `Alexandre Gramfort`_.

- |API| The use of :class:`linear_model.lars_path` with ``X=None``
while passing ``Gram`` is deprecated in version 0.21 and will be removed
in version 0.23. Use :class:`linear_model.lars_path_gram` instead.
:issue:`11699` by :user:`Kuai Yu <yukuairoy>`.

- |API| :func:`linear_model.logistic_regression_path` is deprecated
in version 0.21 and will be removed in version 0.23.
:issue:`12821` by :user:`Nicolas Hug <NicolasHug>`.

:mod:`sklearn.manifold`
............................
Expand Down
6 changes: 3 additions & 3 deletions sklearn/covariance/graph_lasso_.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from ..exceptions import ConvergenceWarning
from ..utils.validation import check_random_state, check_array
from ..utils import deprecated
from ..linear_model import lars_path
from ..linear_model import cd_fast
from ..linear_model import lars_path_gram
from ..model_selection import check_cv, cross_val_score
from ..utils._joblib import Parallel, delayed

Expand Down Expand Up @@ -228,8 +228,8 @@ def graphical_lasso(emp_cov, alpha, cov_init=None, mode='cd', tol=1e-4,
check_random_state(None), False)
else:
# Use LARS
_, _, coefs = lars_path(
sub_covariance, row, Xy=row, Gram=sub_covariance,
_, _, coefs = lars_path_gram(
Xy=row, Gram=sub_covariance, n_samples=row.size,
alpha_min=alpha / (n_features - 1), copy_Gram=True,
eps=eps, method='lars', return_path=False)
# Update the precision matrix
Expand Down
5 changes: 3 additions & 2 deletions sklearn/linear_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from .base import LinearRegression

from .bayes import BayesianRidge, ARDRegression
from .least_angle import (Lars, LassoLars, lars_path, LarsCV, LassoLarsCV,
LassoLarsIC)
from .least_angle import (Lars, LassoLars, lars_path, lars_path_gram, LarsCV,
LassoLarsCV, LassoLarsIC)
from .coordinate_descent import (Lasso, ElasticNet, LassoCV, ElasticNetCV,
lasso_path, enet_path, MultiTaskLasso,
MultiTaskElasticNet, MultiTaskElasticNetCV,
Expand Down Expand Up @@ -72,6 +72,7 @@
'TheilSenRegressor',
'enet_path',
'lars_path',
'lars_path_gram',
'lasso_path',
'logistic_regression_path',
'orthogonal_mp',
Expand Down
Loading