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

Potential issue in user guide for CoxnetSurvivalAnalysis #186

Closed
mfergie opened this issue Mar 13, 2021 · 1 comment
Closed

Potential issue in user guide for CoxnetSurvivalAnalysis #186

mfergie opened this issue Mar 13, 2021 · 1 comment

Comments

@mfergie
Copy link

mfergie commented Mar 13, 2021

From my understanding of the user guide on CoxnetSurvivalAnalysis, the GridSearchCV should be evaluated over the set of alphas identified by fitting the CoxNet model to the full data. Instead, it is ran over the set of alphas defined using linspace further up in the code.

Unless I'm mistaken, the code in box 11 should be:

cv = KFold(n_splits=5, shuffle=True, random_state=0)
gcv = GridSearchCV(
    make_pipeline(StandardScaler(), CoxnetSurvivalAnalysis(l1_ratio=0.9)),
    param_grid={
        "coxnetsurvivalanalysis__alphas": [
            [v] for v in coxnet_pipe.named_steps["coxnetsurvivalanalysis"].alphas_
        ]
    },
    cv=cv,
    error_score=0.5,
    n_jobs=4).fit(Xt, y)

cv_results = pd.DataFrame(gcv.cv_results_)

This gives different results:
Screenshot 2021-03-13 at 18 21 06

P.s. thanks for all your work on this library.

@sebp
Copy link
Owner

sebp commented Mar 14, 2021

Good catch! It explains why the graph looked so weird.

@sebp sebp closed this as completed in fc47a68 Mar 14, 2021
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

No branches or pull requests

2 participants