# NOT RUN {
# Although `glm` only has a formula interface, different
# methods for specifying the model can be used
data("lending_club")
lm_mod <- logistic_reg()
using_formula <-
fit(lm_mod,
Class ~ funded_amnt + int_rate,
data = lending_club,
engine = "glm")
# NOTE: use named arguments for "x" and "y" when using this interface
using_xy <-
fit(lm_mod,
x = lending_club[, c("funded_amnt", "int_rate")],
y = lending_club$Class,
engine = "glm")
# NOTE: use named arguments for "recipe" and "data" when using this interface
library(recipes)
lend_rec <- recipe(Class ~ funded_amnt + int_rate,
data = lending_club)
using_recipe <-
fit(lm_mod,
recipe = lend_rec,
data = lending_club,
engine = "glm")
coef(using_formula)
coef(using_xy)
coef(using_recipe)
# Using other options:
# }
Run the code above in your browser using DataCamp Workspace