brulee-coefs {brulee} | R Documentation |
Extract Model Coefficients
Description
Extract Model Coefficients
Usage
## S3 method for class 'brulee_logistic_reg'
coef(object, epoch = NULL, ...)
## S3 method for class 'brulee_linear_reg'
coef(object, epoch = NULL, ...)
## S3 method for class 'brulee_mlp'
coef(object, epoch = NULL, ...)
## S3 method for class 'brulee_multinomial_reg'
coef(object, epoch = NULL, ...)
Arguments
object |
A model fit from brulee. |
epoch |
A single integer for the training iteration. If left |
... |
Not currently used. |
Value
For logistic/linear regression, a named vector. For neural networks, a list of arrays.
Examples
if (torch::torch_is_installed()) {
data(ames, package = "modeldata")
ames$Sale_Price <- log10(ames$Sale_Price)
set.seed(1)
in_train <- sample(1:nrow(ames), 2000)
ames_train <- ames[ in_train,]
ames_test <- ames[-in_train,]
# Using recipe
library(recipes)
ames_rec <-
recipe(Sale_Price ~ Longitude + Latitude, data = ames_train) %>%
step_normalize(all_numeric_predictors())
set.seed(2)
fit <- brulee_linear_reg(ames_rec, data = ames_train,
epochs = 50, batch_size = 32)
coef(fit)
coef(fit, epoch = 1)
}
[Package brulee version 0.3.0 Index]