new_dragon <- data.frame(year_of_birth = 200,
height = 80,
weight = 12.5,
scars = 0,
number_of_lost_teeth = 5)
dragon_lm_model4 <- lm(life_length ~ year_of_birth + height +
weight + scars + number_of_lost_teeth,
data = dragons)
dragon_lm_explainer4 <- explain(dragon_lm_model4, data = dragons, y = dragons$year_of_birth,
label = "model_4v")
dragon_lm_predict4 <- predict_profile(dragon_lm_explainer4,
new_observation = new_dragon,
variables = c("year_of_birth", "height", "scars"))
head(dragon_lm_predict4)
plot(dragon_lm_predict4,
variables = c("year_of_birth", "height", "scars"))
# \donttest{
library("ranger")
dragon_ranger_model4 <- ranger(life_length ~ year_of_birth + height +
weight + scars + number_of_lost_teeth,
data = dragons, num.trees = 50)
dragon_ranger_explainer4 <- explain(dragon_ranger_model4, data = dragons, y = dragons$year_of_birth,
label = "model_ranger")
dragon_ranger_predict4 <- predict_profile(dragon_ranger_explainer4,
new_observation = new_dragon,
variables = c("year_of_birth", "height", "scars"))
head(dragon_ranger_predict4)
plot(dragon_ranger_predict4,
variables = c("year_of_birth", "height", "scars"))
# }
Run the code above in your browser using DataLab