Enhancement for `penalty`
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 114
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
This is an enhancement request, not a real issue. And it's not very urgent, I would say.
In my opinion, it's kind of hard for the user to specify argument penalty of varsel() and cv_varsel(), for two reasons:
penaltyexpects a vector of indices (for the coefficients, not the terms) and it's kind of difficult to know the "table" to which the indices refer (with "table", I mean the full vector of coefficient indices together with the mapping from indices to coefficients).- Categorical predictors with more than 2 categories have more than coefficient, so it gets even harder to know the "table" to which the indices refer.
So my suggestion would be to:
- Add a convenience function giving the possible coefficient names to the user. I'm not 100% sure, but I think they are the column names of the
"model.matrix"from these lines: https://github.com/stan-dev/projpred/blob/a6c32fe04abb9b570ad7addcc9967267796b8023/R/search.R#L148-L151 Btw, that new function could also offer an optional argument for returning the possible terms (not coefficient names). For that, I think it could rely on https://github.com/stan-dev/projpred/blob/9b906cf0871d40919446ad6e92f442d77f939b3b/R/project.R#L142-L148 - Either stop here or go ahead and let
penaltyalso accept the coefficient names, not only the coefficient indices.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in R/search.R at lines 148-151 to inspect how model-matrix coefficient names are obtained, then compare R/project.R lines 142-148 for the term mapping. Decide the intended scope between a function that exposes coefficient or term names and allowing penalty to accept names. Done means the chosen interface is documented and covered by relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100