I faced this error Error: Element ``id`` should have unique values. Duplicates exist for item(s): 'penalty', 'mixture"
when tuning a model with tidymodels. It took me a while to catch the cause of the error.
I'm posting it here in case some one faces the same error.
library(tidymodels)
#> ── Attaching packages ─────────────────────────────────────────────────────────────────── tidymodels 0.1.1 ──
#> ✓ broom 0.7.1 ✓ recipes 0.1.13
#> ✓ dials 0.0.9 ✓ rsample 0.0.8
#> ✓ dplyr 1.0.2 ✓ tibble 3.0.3
#> ✓ ggplot2 3.3.2 ✓ tidyr 1.1.2
#> ✓ infer 0.5.3 ✓ tune 0.1.1
#> ✓ modeldata 0.0.2 ✓ workflows 0.2.0
#> ✓ parsnip 0.1.3 ✓ yardstick 0.0.7
#> ✓ purrr 0.3.4
#> ── Conflicts ────────────────────────────────────────────────────────────────────── tidymodels_conflicts() ──
#> x purrr::discard() masks scales::discard()
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag() masks stats::lag()
#> x recipes::step() masks stats::step()
lr_spec <-
linear_reg() %>%
set_engine(
"glmnet",
penalty = tune(),
mixture = tune()) %>%
set_mode("regression")
parameters(lr_spec)
#> Error: Element `id` should have unique values. Duplicates exist for item(s): 'penalty', 'mixture'
Created on 2021-04-13 by the reprex package (v0.3.0)