Closed bgreenwell closed 4 years ago
What if - rather than do a hard backward compatibility break with branch issue-79-80 we do deprecation warning? This would require us to retain more code since we'd have to still allow aesthetics as they were stated in current versions plus allow the new aesthetics option but it wouldn't force a hard version break.
Just an option if we're worried about ticking off early adopters of the package with a hard version break.
Seems reasonable. It’ll take a bit of code but I’ll work on it!
@bradleyboehmke got it. The old approach should still work, but with a warning that these features will be removed in the next planned version.
Example:
# Load required packages
library(ggplot2) # for `aes_string()` function
# Load the sample data
data(mtcars)
# Fit a linear regression model
model <- lm(mpg ~ ., data = mtcars)
# Construct variable importance plots
p1 <- vip(model)
p2 <- vip(model, mapping = aes_string(color = "Sign"))
p3 <- vip(model, geom = "point")
p4 <- vip(model, geom = "point", mapping = aes_string(color = "Variable"),
aesthetics = list(size = 3))
grid.arrange(p1, p2, p3, p4, nrow = 2)
# Make sure old approach still works, albeit with a warning
vip(model, bar = FALSE)
vip(model, bar = FALSE, color = "red")
vip(model, bar = TRUE, color = "red", fill = "green")
vip(model, bar = TRUE, color = "red", fill = "green", width = 1/3)
Try to break it if you can and I'll merge when we're happy with it.
The updates look good. Not sure if you realize or not but the type
arguments you provided don't do anything (older version??).
i.e.:
vip(model, type = "dotplot") # old
vip(rf_model, type = "impurity", geom = "point") # new
Oops, forgot to mention. I renamed the new type
argument to geom
so that it doesn't conflict with the type
argument to vi_model()
which can be passed via ...
in vi()
and vip()
. I updated the docs in ?vip::vip
quite a bit make it clear.
For example,
instead of