eigen_tol in _spectral_embedding.py does not propagate to solvers other than arpack
See original GitHub issueDescribe the bug
In _spectral_embedding.py
the option
eigen_tol : float, default=0.0
Stopping criterion for eigendecomposition of the Laplacian matrix
when ``eigen_solver='arpack'``.
does not appear to propagate to solvers ‘amg’ and ‘lobpcg’, e.g., adding eigen_tol
and changing its value in examples/cluster/plot_coin_segmentation.py
affects the outcome only if eigen_solver='arpack'
, which is the default but not for the other two: ‘lobpcg’ and ‘amg’.
Steps/Code to Reproduce
See above
Expected Results
eigen_tol
works for all supported solvers
Actual Results
eigen_tol
works for `eigen_solver=‘arpack’ only and is ignored otherwise
While at it
Also introduce and pass max_iter
param to all eigen solvers, although maybe it should be named eigen_max_iter
to avoid confusion.
Versions
System:
python: 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
executable: C:\Users\Name\AppData\Local\Programs\Python\Python37\python.exe
machine: Windows-10-10.0.19041-SP0
Python dependencies: pip: 21.2.4 setuptools: 58.1.0 sklearn: 1.0 numpy: 1.21.2 scipy: 1.7.1 Cython: 0.29.24 pandas: 1.3.3 matplotlib: 3.4.3 joblib: 1.0.1 threadpoolctl: 2.2.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
To be backward compatible, we can have
eigen_tol=None
and pass in 0 to arpack, which is machine precision internally. Forlobpcg
andamg
, we continue to pass in1e-5
wheneigen_tol=None
. Ifeigen_tol
is a float, we can pass it in directly.Does this sound reasonable?
While at it, may be also fix https://github.com/scikit-learn/scikit-learn/issues/14713 ?