Skip to content

Disable early stopping criteria - #484

Closed
Sann5 wants to merge 1 commit into
sebp:masterfrom
Sann5:disable-early-stopping
Closed

Sann5 wants to merge 1 commit into
sebp:masterfrom
Sann5:disable-early-stopping

Conversation

@Sann5

@Sann5 Sann5 commented Oct 21, 2024

Copy link
Copy Markdown

Checklist

  • closes Alpha Behavior #41
  • pytest passes pytest (that were passing before) passes
  • tests are included (no tests added)
  • code is well formatted
  • documentation renders correctly (this idk)

What does this implement/fix? Explain your changes
In sksurv/linear_model/src/coxnet/coxnet.h we find the fit method for the CoxnetSurvivalAnalysis class. This fits a model for the desired regularization path. The current implementation includes an early stop condition which stops fiting a model for the given alphas based on a deviance ratio. However it is desirable sometimes to fit the whole path (using all the alphas) even if the performance does not change significanly across alphas (see #41 for a more detailed explanation of the behaviour). The obvios solution is to get rid of the early stop condition (which is what I have done here by commentitg it out), however I think the better solution would be to include a boolean flag in the class definition that specifies if the user wishes or not to use this early stopping functionality. Sadly I do not have the time to implement such a solution. Please feel free to use this PR as a starting point.

@sebp

sebp commented Oct 22, 2024 •

Copy link
Copy Markdown
Owner

You are correct that this part of the code is probably the reason why coefficients for at most 5 alphas are returned.

However, this check is also part of the reference implementation in the R glmnet package: https://github.com/cran/glmnet/blob/ace3461223a8fe8a3e0c2f749d3d7e8e84e49ea8/src/glmnet3.f90#L4460

Hence, the code does have its purpose. The main question is where the two implementations deviate from each other. I would suggest to use an example where sksurv terminates early and compare the steps in glmnet and sksurv with a debugger.

@sebp

sebp commented Nov 5, 2025

Copy link
Copy Markdown
Owner

I'm closing this PR as no further information has been provided. Please feel free to reopen this PR if you can provide the requested information.

@sebp sebp closed this Nov 5, 2025
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.

Alpha Behavior

2 participants