Description Usage Arguments Value Examples
View source: R/viz_prob_region.R
This function is mostly useful in an educational setting. Can only be used with trained workflow objects with 2 numeric predictor variables.
1 | viz_prob_region(x, new_data, resolution = 100, expand = 0.1, facet = FALSE)
|
x |
trained 'workflows::workflow' object. |
new_data |
A data frame or tibble for whom the preprocessing will be applied. |
resolution |
Number of squared in grid. Defaults to 100. |
expand |
Expansion rate. Defaults to 0.1. This means that the width and height of the shaded area is 10 data. |
facet |
Logical, whether to facet chart by class. Defaults to FALSE. The chart have been minimally modified to allow for easier styling. |
'ggplot2::ggplot' object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(parsnip)
library(workflows)
iris2 <- iris
iris2$Species <- factor(iris2$Species == "setosa",
labels = c("setosa", "not setosa"))
svm_spec <- svm_rbf() %>%
set_mode("classification") %>%
set_engine("kernlab")
svm_fit <- workflow() %>%
add_formula(Species ~ Petal.Length + Petal.Width) %>%
add_model(svm_spec) %>%
fit(iris2)
viz_prob_region(svm_fit, iris2)
viz_prob_region(svm_fit, iris2, resolution = 20)
viz_prob_region(svm_fit, iris2, expand = 1)
viz_prob_region(svm_fit, iris2, facet = TRUE)
knn_spec <- nearest_neighbor() %>%
set_mode("classification") %>%
set_engine("kknn")
knn_fit <- workflow() %>%
add_formula(class ~ umap_1 + umap_2) %>%
add_model(knn_spec) %>%
fit(mnist_sample)
viz_prob_region(knn_fit, mnist_sample, facet = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.