View source: R/plot_robustness.R
| plot_robustness | R Documentation |
Visualizes how model performance (robustness) decreases as the level of input noise increases. This "decay curve" is a powerful tool for understanding the sensitivity threshold of a machine learning model.
plot_robustness(
predict_fn,
X,
levels = seq(0, 0.3, by = 0.05),
n_rep = 5L,
...
)
predict_fn |
A function that accepts a numeric matrix and returns a numeric vector of predictions. |
X |
A numeric matrix or data.frame of input features. |
levels |
A numeric vector of noise levels to evaluate.
Default is |
n_rep |
Number of repetitions for each noise level. Default is |
... |
Additional arguments passed to |
A data.frame with columns noise_level and robustness_score.
# Simple model
pred_fn <- function(X) X %*% c(1, -1)
X <- matrix(rnorm(200), ncol = 2)
# Plot decay
plot_robustness(pred_fn, X, main = "Model Robustness Decay")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.