ikea <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-11-03/ikea.csv')
## New names:
## Rows: 3694 Columns: 14
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (7): name, category, old_price, link, other_colors, short_description, d... dbl
## (6): ...1, item_id, price, depth, height, width lgl (1): sellable_online
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
skimr::skim(ikea)
Name | ikea |
Number of rows | 3694 |
Number of columns | 14 |
_______________________ | |
Column type frequency: | |
character | 7 |
logical | 1 |
numeric | 6 |
________________________ | |
Group variables | None |
Variable type: character
skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
---|---|---|---|---|---|---|---|
name | 0 | 1 | 3 | 27 | 0 | 607 | 0 |
category | 0 | 1 | 4 | 36 | 0 | 17 | 0 |
old_price | 0 | 1 | 4 | 13 | 0 | 365 | 0 |
link | 0 | 1 | 52 | 163 | 0 | 2962 | 0 |
other_colors | 0 | 1 | 2 | 3 | 0 | 2 | 0 |
short_description | 0 | 1 | 3 | 63 | 0 | 1706 | 0 |
designer | 0 | 1 | 3 | 1261 | 0 | 381 | 0 |
Variable type: logical
skim_variable | n_missing | complete_rate | mean | count |
---|---|---|---|---|
sellable_online | 0 | 1 | 0.99 | TRU: 3666, FAL: 28 |
Variable type: numeric
skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
---|---|---|---|---|---|---|---|---|---|---|
…1 | 0 | 1.00 | 1846.50 | 1066.51 | 0 | 923.25 | 1846.5 | 2769.75 | 3693 | ▇▇▇▇▇ |
item_id | 0 | 1.00 | 48632396.79 | 28887094.10 | 58487 | 20390574.00 | 49288078.0 | 70403572.75 | 99932615 | ▇▇▇▇▇ |
price | 0 | 1.00 | 1078.21 | 1374.65 | 3 | 180.90 | 544.7 | 1429.50 | 9585 | ▇▁▁▁▁ |
depth | 1463 | 0.60 | 54.38 | 29.96 | 1 | 38.00 | 47.0 | 60.00 | 257 | ▇▃▁▁▁ |
height | 988 | 0.73 | 101.68 | 61.10 | 1 | 67.00 | 83.0 | 124.00 | 700 | ▇▂▁▁▁ |
width | 589 | 0.84 | 104.47 | 71.13 | 1 | 60.00 | 80.0 | 140.00 | 420 | ▇▅▂▁▁ |
data <- ikea %>%
na.omit() %>%
# Remove unnecessary columns and treat missing values
select(-old_price, -link, -...1) %>%
# Handle multiple designers
separate_rows(designer, sep = "/") %>%
# Convert character variables to factors
mutate(across(where(is.character), as.factor)) %>%
mutate(short_description = as.character(short_description)) %>%
# Convert logical variables to factors
mutate(across(where(is.logical), as.factor)) %>%
# Log transform price (ensure no zero or negative values)
mutate(price = log(price))
Identify good predictors
# Category
data %>%
ggplot(aes(price, category)) +
geom_boxplot()
# Designer
data %>%
# Tokenize description text
unnest_tokens(output = word, input = short_description) %>%
# calculate avg rent per word
group_by(word) %>%
summarise(price = mean(price),
n = n()) %>%
ungroup() %>%
filter(n > 10, !str_detect(word, "\\d")) %>%
slice_max(order_by = price, n = 10) %>%
# Plot
ggplot(aes(price, fct_reorder(word, price))) +
geom_point() +
labs(y = "Products")
EDA shortcut
# Step 1:Prepare data
#Select
#take out short description, and keep designer
data_binarize_tbl <- data %>%
select(price, height, width, depth, category, other_colors, sellable_online) %>%
binarize()
data_binarize_tbl %>% glimpse()
## Rows: 2,714
## Columns: 35
## $ `price__-Inf_5.84354441703136` <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1…
## $ price__5.84354441703136_6.75693238924755 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ price__6.75693238924755_7.52023455647463 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ price__7.52023455647463_Inf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `height__-Inf_74` <dbl> 0, 1, 0, 0, 0, 0, 0, 0, 0…
## $ height__74_95 <dbl> 0, 0, 1, 1, 1, 1, 1, 0, 0…
## $ height__95_180.75 <dbl> 1, 0, 0, 0, 0, 0, 0, 1, 1…
## $ height__180.75_Inf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `width__-Inf_60` <dbl> 1, 0, 1, 1, 1, 1, 1, 1, 1…
## $ width__60_100 <dbl> 0, 1, 0, 0, 0, 0, 0, 0, 0…
## $ width__100_180 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ width__180_Inf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `depth__-Inf_40` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ depth__40_48 <dbl> 0, 0, 1, 1, 1, 1, 1, 1, 1…
## $ depth__48_66 <dbl> 1, 1, 0, 0, 0, 0, 0, 0, 0…
## $ depth__66_Inf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ category__Bar_furniture <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1…
## $ category__Beds <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__Bookcases_&_shelving_units` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__Cabinets_&_cupboards` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ category__Café_furniture <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ category__Chairs <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__Chests_of_drawers_&_drawer_units` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__Children's_furniture` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ category__Nursery_furniture <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ category__Outdoor_furniture <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__Sofas_&_armchairs` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__Tables_&_desks` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__TV_&_media_furniture` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ category__Wardrobes <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `category__-OTHER` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ other_colors__No <dbl> 0, 1, 1, 1, 1, 1, 1, 1, 1…
## $ other_colors__Yes <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 0…
## $ sellable_online__TRUE <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1…
## $ `sellable_online__-OTHER` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
# Step 2: Correlate
data_corr_tbl <- data_binarize_tbl %>%
correlate(price__7.52023455647463_Inf)
data_corr_tbl
## # A tibble: 35 × 3
## feature bin correlation
## <fct> <chr> <dbl>
## 1 price 7.52023455647463_Inf 1
## 2 width 180_Inf 0.610
## 3 depth 66_Inf 0.418
## 4 width -Inf_60 -0.356
## 5 category Sofas_&_armchairs 0.343
## 6 price -Inf_5.84354441703136 -0.335
## 7 price 6.75693238924755_7.52023455647463 -0.333
## 8 price 5.84354441703136_6.75693238924755 -0.332
## 9 category Wardrobes 0.302
## 10 height -Inf_74 -0.283
## # ℹ 25 more rows
# Step 3: Plot
data_corr_tbl %>%
plot_correlation_funnel()
## Warning: ggrepel: 12 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
Split data
data2 <- data %>%
select(-other_colors)
# Split into train and test data set
set.seed(1234)
ikea_split <- rsample::initial_split(data2, prop = 0.75)
ikea_train <- training(ikea_split)
ikea_test <- testing(ikea_split)
# Specify recipe
ikea_recipe <- recipe(formula = price ~ ., data = ikea_train) %>%
update_role(item_id, new_role = "id variable") %>%
step_tokenize(short_description) %>%
step_tokenfilter(short_description, max_tokens = 100) %>% # Missing argument
step_tfidf(short_description) %>%
step_other(category, name, designer, threshold = 0.2) %>%
step_dummy(all_nominal_predictors()) %>%
step_log(height, width, depth)
# Now, prep and juice
ikea_recipe %>% prep() %>% juice() %>% glimpse()
## Rows: 2,035
## Columns: 109
## $ item_id <dbl> 9219527, 99248380, 59157555, 1028…
## $ depth <dbl> 3.951244, 3.401197, 4.007333, 3.5…
## $ height <dbl> 4.454347, 4.820282, 5.375278, 4.4…
## $ width <dbl> 3.891820, 5.556828, 5.105945, 3.6…
## $ price <dbl> 4.595120, 6.897705, 7.338238, 6.3…
## $ tfidf_short_description_1 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_100x60x236 <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_150x44x236 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_150x58x201 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_150x60x201 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_150x60x236 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_150x66x236 <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_2 <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_200x60x236 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_200x66x236 <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_3 <dbl> 0.0000000, 0.5114545, 0.8524242, …
## $ tfidf_short_description_35x35x35 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_4 <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_41x101 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_41x61 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_5 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_6 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_60x50x128 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_61x101 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_63 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_74 <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_76 <dbl> 0.000000, 0.000000, 0.000000, 1.1…
## $ tfidf_short_description_8 <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_80x200 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_80x30x202 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_90 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_90x200 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_add <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_and <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_armchair <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_armrest <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_armrests <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_backrest <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_bar <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_baskets <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_bed <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_bedside <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_bench <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_bookcase <dbl> 0.000, 0.000, 0.000, 0.000, 0.000…
## $ tfidf_short_description_cabinet <dbl> 0.0000000, 0.5407864, 0.0000000, …
## $ tfidf_short_description_castors <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_chair <dbl> 2.684967, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_chaise <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_changing <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_chest <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ `tfidf_short_description_children's` <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_cm <dbl> 0.0000000, 0.1776674, 0.2961123, …
## $ tfidf_short_description_combination <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_corner <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_cover <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_day <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_desk <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_door <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_doors <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_drawer <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_drawers <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_feet <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_foldable <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_for <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_frame <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_glass <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_highchair <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_in <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_inserts <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_junior <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_leg <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_legs <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_lock <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_longue <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_mesh <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_modular <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_module <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_mounted <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_of <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_on <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_outdoor <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_panel <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_plinth <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_seat <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_section <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_sections <dbl> 0.0000000, 0.7998332, 1.3330553, …
## $ tfidf_short_description_shelf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_shelves <dbl> 0.0000000, 0.7666921, 0.0000000, …
## $ tfidf_short_description_shelving <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_side <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_sliding <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_smart <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_sofa <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_stool <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_storage <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_table <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_top <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_tv <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_unit <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_upright <dbl> 0.000000, 0.000000, 0.000000, 0.0…
## $ tfidf_short_description_w <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_wall <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_wardrobe <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ tfidf_short_description_wire <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ tfidf_short_description_with <dbl> 0.0000000, 0.0000000, 0.0000000, …
## $ name_other <dbl> 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, …
## $ category_other <dbl> 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, …
## $ sellable_online_TRUE. <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ designer_other <dbl> 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, …
# Specify model
xgboost_spec <-
boost_tree(trees = tune(), min_n = tune(), mtry = tune(), learn_rate = tune())%>%
set_mode("regression") %>%
set_engine("xgboost")
# Combine recipe and model using workflow
xgboost_workflow <-
workflow() %>%
add_recipe(ikea_recipe) %>%
add_model(xgboost_spec)
# Create cross-validation folds
set.seed(2345)
ikea_cv <- vfold_cv(ikea_train, v = 5)
# Tune hyperperameters
set.seed(3456)
xgboost_tune <-
tune_grid(xgboost_workflow,
resamples = ikea_cv,
grid = 10)
## i Creating pre-processing data to finalize unknown parameter: mtry
# Show the best hyperparameters based on RMSE
tune::show_best(xgboost_tune, metric = "rmse")
## # A tibble: 5 × 10
## mtry trees min_n learn_rate .metric .estimator mean n std_err .config
## <int> <int> <int> <dbl> <chr> <chr> <dbl> <int> <dbl> <chr>
## 1 56 1741 3 0.0868 rmse standard 0.316 5 0.0163 Preproces…
## 2 80 922 22 0.204 rmse standard 0.331 5 0.0166 Preproces…
## 3 13 1578 15 0.130 rmse standard 0.334 5 0.0124 Preproces…
## 4 65 656 18 0.0521 rmse standard 0.353 5 0.0135 Preproces…
## 5 42 1808 39 0.0128 rmse standard 0.386 5 0.00960 Preproces…
# Update de model by selecting the best hyperparameter
xgboost_fw <- tune::finalize_workflow(xgboost_workflow,
tune::select_best(xgboost_tune, metric = "rmse"))
# Fit the model on the entire training data and test it on the test data
ikea_fit <- tune::last_fit(xgboost_fw, ikea_split)
tune::collect_metrics(ikea_fit)
## # A tibble: 2 × 4
## .metric .estimator .estimate .config
## <chr> <chr> <dbl> <chr>
## 1 rmse standard 0.267 Preprocessor1_Model1
## 2 rsq standard 0.952 Preprocessor1_Model1
tune::collect_predictions(ikea_fit) %>%
ggplot(aes(price, .pred)) +
geom_point(alpha = 0.3, color = "purple4") +
geom_abline(lty = 2, color = "gray30") +
coord_fixed()
Throughout the model refinement process, I experimented with various parameters, including tinker with threshold, max_token, and grid, to optimize performance. Initially, adjusting threshold to 0.05 improved RMSE but slightly worsened R-squared. Increasing threshold to 0.2 resulted in a worse RMSE while keeping R-squared unchanged. Lowering max_token to 50 yielded worse results, while reverting to 100 improved both metrics. Switching the grid to 10 further enhanced performance.