Hi,
I am new to tidymodels and I am struggling to understand where some arguments in the tidymodel example comes from. I am using this example for reference: https://www.tidymodels.org/learn/models/parsnip-ranger-glmnet
I 'm able to follow the example right the way through but just at the end they plot the Sale_Price Vs. the predicted value from the test_result
object for both the GLMNET and regularised regression model.
When I inspect the test_result variable I can see three columns, Sale_Price, random forest
and glmnet yet the first line of the example uses gather with model and prediction and drops/de-selects Sale_Price:
# PLOT OF THE PERFORMANCE OF THE REGULARISED GLMNET Vs. THE RANDOM FOREST MODEL
test_results %>%
gather(model, prediction, -Sale_Price) %>%
ggplot(aes(x = prediction, y = Sale_Price)) +
geom_abline(col = "green", lty = 2) +
geom_point(alpha = .4) +
facet_wrap(~model) +
coord_fixed()
My question here is, what is the purpose of gather and where are model and prediction coming from as they're not in my test_results object?
Thank you.