Skip to content
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

Disable early stopping criteria #484

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sann5
Copy link

@Sann5 Sann5 commented Oct 21, 2024

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
Copy link
Owner

sebp commented Oct 22, 2024

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.

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