Skip to content

Switch default optimizer to CG with multi-start#1284

Open
Marius1311 wants to merge 1 commit into
mainfrom
feat/cg-optimizer-default
Open

Switch default optimizer to CG with multi-start#1284
Marius1311 wants to merge 1 commit into
mainfrom
feat/cg-optimizer-default

Conversation

@Marius1311

Copy link
Copy Markdown
Collaborator

Summary

Switch the default GPCCA rotation optimizer from Nelder-Mead to conjugate gradient (CG) with 10 random restarts. This makes compute_macrostates() scale to large numbers of macrostates (m > 15) where Nelder-Mead becomes impractical.

Changes

  • Default optimizer: "Nelder-Mead""CG"
  • Default n_starts: 110 (with perturbation_scale=0.1)
  • New parameters on compute_macrostates(): n_starts, perturbation_scale, seed — these were already supported by pyGPCCA but not exposed in CellRank
  • fit() method: Now forwards optimizer parameters to compute_macrostates() (previously always used hardcoded defaults)
  • .gitignore: Added uv.lock and .github/prompts/

Benchmark results

Validated on pancreas (2,531 cells) and bone marrow (5,780 cells) datasets:

m NM 1× crispness (time) CG 10×0.1 crispness (time)
5 0.513 (0.1s) 0.477 (0.2s)
10 0.234 (1.6s) 0.243 (0.4s)
15 0.123 (13.7s) 0.221 (2.2s)
50 infeasible 0.063 (30.0s)
  • CG 10×0.1 matches or beats NM on crispness at m ≥ 8
  • High membership agreement: mean Pearson r ≥ 0.94, Jaccard ≥ 0.70
  • All CG solutions are non-degenerate (no empty clusters)
  • Extrapolated: CG 10×0.1 at m=50, n=1M ≈ 3.3 hrs (NM infeasible)

Dependencies

Requires pyGPCCA from msmdev/pyGPCCA branch feature/gradient-optimization which implements the analytical Jacobian and multi-start SO(k) rotation perturbation.

Switch the default GPCCA rotation optimizer from Nelder-Mead to conjugate
gradient (CG) with 10 random restarts so that compute_macrostates() scales
to large numbers of macrostates (m > 15) where Nelder-Mead is impractical.

- Default optimizer: "Nelder-Mead" -> "CG"
- Default n_starts: 1 -> 10 (perturbation_scale=0.1)
- Expose n_starts, perturbation_scale, seed on compute_macrostates()
- fit() now forwards optimizer parameters to compute_macrostates()
- .gitignore: add uv.lock and .github/prompts/

Requires pyGPCCA with the analytical-Jacobian / multi-start SO(k) rotation
support (msmdev/pyGPCCA feature/gradient-optimization).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Marius1311 Marius1311 force-pushed the feat/cg-optimizer-default branch from 05d14d4 to 785a696 Compare June 5, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant