`step_lencode_*()` gives non-ideal errors when applied to constant vectors
Open
Nobody has claimed this yet.
feature
target encoding
- Dominant language
- R
- Stars
- 146
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
library(embed)
library(modeldata)
ames$const <- "red"
recipe(Street ~ const, data = ames) |>
step_lencode_glm(const, outcome = vars(Street)) |>
prep()
#> Error in `step_lencode_glm()`:
#> Caused by error in `purrr::map()`:
#> ℹ In index: 1.
#> ℹ With name: const.
#> Caused by error in `contrasts<-`:
#> ! contrasts can be applied only to factors with 2 or more levels
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
Reproduce the constant-vector example from the issue, then inspect the step_lencode_*() implementations and their existing tests to identify where the contrasts error originates. Done should mean that applying these steps to a constant predictor produces an intentional, user-facing result rather than the current low-level error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100