brulee-autoplot | R Documentation |
Plot model loss over epochs
## S3 method for class 'brulee_mlp'
autoplot(object, ...)
## S3 method for class 'brulee_logistic_reg'
autoplot(object, ...)
## S3 method for class 'brulee_multinomial_reg'
autoplot(object, ...)
## S3 method for class 'brulee_linear_reg'
autoplot(object, ...)
object |
A |
... |
Not currently used |
This function plots the loss function across the available epochs. A vertical line shows the epoch with the best loss value.
A ggplot
object.
if (torch::torch_is_installed()) {
library(ggplot2)
library(recipes)
theme_set(theme_bw())
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,]
ames_rec <-
recipe(Sale_Price ~ Longitude + Latitude, data = ames_train) %>%
step_normalize(all_numeric_predictors())
set.seed(2)
fit <- brulee_mlp(ames_rec, data = ames_train, epochs = 50, batch_size = 32)
autoplot(fit)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.