-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
TuneWrapper with clssif.glmnet does not seem to apply tuned hyperparameter in outer cross-validation #2472
Comments
Hi Martin, thanks for the report. This is indeed a bug in the P.S. I don't know whether you are aware of the |
didnt we have EXACTLY that bug before? and I fixed that? this is due to partial matching in R? |
I don't know if this was here before, but the problem here is unrelated to partial matching. The bug happens because |
Thanks for the quick reply and the hint with cvglmnet! |
I fixed it yesterday on the train. Need to upload and test though. Thx a lot for this report. This was a somewhat weird bug |
@berndbischl Do you have a PR? |
yes here: PR #2479 |
Merged in 7ea4a57. |
I came across this bug when comparing different predictors with "benchmark" and found Lasso to perform surprisingly poor.
So, what I think happens, is that the tuned "s" hyperparameters of "classif.glmnet" are not applied within the outer cross-validation when used in the TuneWrapper setting. The results marelely depend on the initial value of "s"; the extracted tuning values for each cross validation loop appear correct.
To illustrate this, I added three examples on the standard iris data set:
In general, all these exaples should produceto identical results, as the initial value should not matter, but only the tuned value. This was the case when executing the examples with the ksvm classifier, but does not hold for glmnet).
Here is the code:
You can see from the output, that the tuning results are identical for all three examples, but the cross-validation porediction results are not. While the example without initializing "s" and the initialization with 0.01 lead to the same results (r1 and r2, respectively), the initialization with 100 leads to completely different predictions (r3).
This brought me to the conclusion, that the tuned values are not applied in the outer cross validation.
Thanks for looking into this,
Martin
The text was updated successfully, but these errors were encountered: