-
Notifications
You must be signed in to change notification settings - Fork 42
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
Predictions in tune_grid
for poisson regression models appear to be on the link scale (negative values)
#956
Comments
I think this is a result of this bug in poissonreg because |
Ah ok, yes makes sense. Presume that bug also affects |
glmnet allows you to use a family from base-R like you did in So to get correct results, you'd need to
If you use a base-R family, the resulting object is one with a "catch-all" class of |
Ah, and if you directly use |
We might issue a warning when |
The problem
When running
tune_grid
forglmnet
poisson regression models the predictions returned bycollect_predictions()
appear to contain negative values (it looks as though they are on the link scale). This does not seem to be consistent with the behaviour ofpredict
when fitting and evaluating models in the typical way (i.e., outside of tuning procedures).It would seem as though these predictions on the link scale are then used to compute performance metrics by comparing against actual observations on the original response scale (i.e., counts)?
This seems to be inconsistent across cv resamples though; i.e., some folds seem to be on the link scale, other times the response scale (this isn't covered in the example below).
Reproducible example
Created on 2024-11-01 with reprex v2.1.1
Session info
Note, the code below should demonstrate how metrics appear to be calculated using predictions on the link scale. Normal
predict
behaviour doesn't seem to be to usetype = "raw"
.The text was updated successfully, but these errors were encountered: