autoplot.tabnet_explain | R Documentation |
Plot tabnet_explain mask importance heatmap
## S3 method for class 'tabnet_explain'
autoplot(object, type = c("mask_agg", "steps"), quantile = 1, ...)
object |
A |
type |
a character value. Either |
quantile |
numerical value between 0 and 1. Provides quantile clipping of the mask values |
... |
not used. |
Plot the tabnet_explain object mask importance per variable along the predicted dataset.
type="mask_agg"
output a single heatmap of mask aggregated values,
type="steps"
provides a plot faceted along the n_steps
mask present in the model.
quantile=.995
may be used for strong outlier clipping, in order to better highlight
low values. quantile=1
, the default, do not clip any values.
A ggplot
object.
library(ggplot2)
data("attrition", package = "modeldata")
## Single-outcome binary classification of `Attrition` in `attrition` dataset
attrition_fit <- tabnet_fit(Attrition ~. , data=attrition, epoch=11)
attrition_explain <- tabnet_explain(attrition_fit, attrition)
# Plot the model aggregated mask interpretation heatmap
autoplot(attrition_explain)
## Multi-outcome regression on `Sale_Price` and `Pool_Area` in `ames` dataset,
data("ames", package = "modeldata")
ids <- sample(nrow(ames), 256)
x <- ames[ids,-which(names(ames) %in% c("Sale_Price", "Pool_Area"))]
y <- ames[ids, c("Sale_Price", "Pool_Area")]
ames_fit <- tabnet_fit(x, y, epochs = 5, verbose=TRUE)
ames_explain <- tabnet_explain(ames_fit, x)
autoplot(ames_explain, quantile = 0.99)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.