"ConvergenceWarning" in sklearn when calling ”sc.tl.rank_genes_groups“ with method='logreg'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of scanpy.
- (optional) I have confirmed this bug exists on the master branch of scanpy.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can copy&paste without having any data)
sc.tl.rank_genes_groups(adata, 'leiden', method='logreg')
~/miniconda3/envs/tangram-env/lib/python3.8/site-packages/sklearn/linear_model/_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
n_iter_i = _check_optimize_result(
finished (0:07:47)
Versions
scikit-learn=1.0.2
scanpy=1.8.2
It seems the result was still not converged when using the maximal iteration parameter (max_iter=100) in LogisticRegression function of sklearn. I'd like to ask are there any possibilities to pass any parameters from scanpy to sklearn to increase the max_iter value?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at sc.tl.rank_genes_groups with method='logreg' and trace how the sklearn LogisticRegression call is configured. Reproduce the reported ConvergenceWarning using the supplied call and versions; done should be defined by an agreed way to expose or handle the max_iter setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, scikit-learn
- Domain
- bioinformatics, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100