parsnip
is a R package that offers a unified interface to many machine learning models. By writing an interface between condvis2
and parsnip
a vast number of machine learning fits may be explored with condvis
.
A list of models supported by parsnip is found on this link: https://www.tidymodels.org/find/parsnip/
Fit the regression model with parsnip.
library(parsnip)
library(MASS)
library(condvis2)
Boston1 <- Boston[,9:14]
fitlm <-
linear_reg() %>%
set_engine("lm") %>%
fit(medv ~ ., data = Boston1)
fitrf <- rand_forest(mode="regression") %>%
set_engine("randomForest") %>%
fit(medv ~ ., data = Boston1)
Use condvis to explore the models:
Choose tour “Diff fits” to explore differences between the fits
Some tasks, for example linear regression, support confidence intervals. Tell condvis
to plot an interval using pinterval="confidence
for that fit. The forest fit does not support confidence intervals so the predictArgs for that fit are NULL.
Fit some classification models:
clmodel <-
svm_poly(mode="classification") %>%
set_engine("kernlab") %>%
fit(Species ~ ., data = iris )
Explore with condvis
:
condvis(iris, model=clmodel, response="Species", sectionvars=c("Petal.Length", "Petal.Width"), pointColor="Species")
Click on “Show probs” to see class probabilities.
Fit a survival model and explore with condvis:
Unlike mlr
, parsnip
does not yet offer support for clustering fits.