Fix workflowsets imports, zero-coefficient labeling, and feature-cutoff bugs from #31 review - #40
Open
eboyer221 wants to merge 1 commit into
Open
Fix workflowsets imports, zero-coefficient labeling, and feature-cutoff bugs from #31 review#40eboyer221 wants to merge 1 commit into
eboyer221 wants to merge 1 commit into
Conversation
…ture-cutoff bugs from #31 review
eboyer221
requested review from
AbhirupaGhosh,
amcim,
epbrenner and
jananiravi
August 13, 2026 20:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Addresses code review feedback on #31 (the vip::vi() replacement).
Three fixes, plus one item left as an open question:
Orphaned imports.
@importFrom workflowsets extract_fit_parsnipandextract_spec_parsnipare declared but nothing calls them -.viGlmnet()replaced the oldworkflowsets |> vip::vi()chain withparsnip::extract_fit_engine()directly. Removed both, and removedworkflowsetsfrom DESCRIPTION since nothing in the package uses it anymore.Zero coefficients mislabeled.
.viGlmnet()'sSign = ifelse(coefs > 0, "POS", "NEG")labeled an exact-zero coefficient "NEG" - indistinguishable from an actually-negative one. This matters for LASSO/elastic-net models, where zeroing out a coefficient is the normal way a feature gets excluded. Now labeled NA.Last feature silently dropped.
extractTopFeats()'s defaultprop_vi_top_feats = c(0, 1)is documented to return all features butfilter(cum_imp < cum_vi_upper & ...)used a strict<, and the least-important feature's cumulative importance is exactly equal to the total - so it always got excluded. Changed to<=.Left open
Whether
.viGlmnet()should use the tunedpenalty(as the multi-class path inextractTopFeats()already does) instead ofmin(glmnet_fit$lambda)- flagging for @AbhirupaGhosh.Testing
Added two tests to tests/testthat/test-core-ml.R. I confirmed both catch the original bugs by temporarily reverting the fix and re-running: the zero-coefficient test failed as expected, and testing against a real fitted model reproduced the exact symptom described - the least important feature (feat_noise_1) silently missing from the result. Full suite passes (214/214).