| classbound | R Documentation |
A high-level unified wrapper to fit a model, compute its 2D decision boundary, and plot the results in a single step.
classbound(
data,
formula,
classifier,
interface = c("formula", "matrix", "custom"),
projection = NULL,
fit_args = list(),
predict_args = list(),
predfun = NULL,
resolution = 100,
...
)
data |
A data frame containing the full training dataset. The specific variables
used for modeling and plotting are strictly determined by the |
formula |
A formula specifying the response and predictors. |
classifier |
The classification function to use (e.g., |
interface |
A string specifying how to invoke the classifier: |
projection |
An optional list (e.g., |
fit_args |
A named list of additional arguments passed to the classifier during fitting. |
predict_args |
A named list of additional arguments passed to |
predfun |
A custom function to generate predictions for non-standard models. |
resolution |
An integer specifying the grid resolution for the decision boundary. |
... |
Additional arguments passed to |
A ggplot object visualizing the 2D decision boundary and original observations.
library(palmerpenguins)
data(penguins)
peng_data <- na.omit(penguins[, c("species", "bill_length_mm", "bill_depth_mm")])
# Quick 2D boundary visualization for an SVM
classbound(peng_data, species ~ bill_length_mm + bill_depth_mm, e1071::svm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.