library(cheem)
library(spinifex)
## Regression setup
dat <- amesHousing2018_NorthAmes
X <- dat[, 1:9]
Y <- dat$SalePrice
clas <- dat$SubclassMS
## Basis, manipulation var, manual tour path, & predictions to fix to y-axis
bas <- sug_basis(ames_rf_shap, 1)
mv <- sug_manip_var(ames_rf_shap, 1, 2)
mt_path <- manual_tour(bas, mv)
## Also consumed by: ?radial_cheem_tour()
## Compose and animate the tour
ggt <- ggtour(mt_path, scale_sd(X), angle = .3) +
append_fixed_y(fixed_y = scale_sd(Y)) +
proto_point(list(color = clas, shape = clas)) +
proto_basis1d_distribution(
attr_df = ames_rf_shap,
primary_obs = 1, comparison_obs = 2,
position = "top1d", group_by = clas) +
proto_basis1d(position = "bottom1d") +
proto_origin()
if(interactive()){
animate_plotly(ggt)
}
Run the code above in your browser using DataLab