continue_training {cito} | R Documentation |
Continues training of a model for additional periods
continue_training(
model,
epochs = 32,
continue_from = NULL,
data = NULL,
device = "cpu",
verbose = TRUE,
changed_params = NULL
)
model |
a model created by |
epochs |
additional epochs the training should continue for |
continue_from |
define which epoch should be used as starting point for training, 0 if last epoch should be used |
data |
matrix or data.frame if not provided data from original training will be used |
device |
device on which network should be trained on, either "cpu" or "cuda" |
verbose |
print training and validation loss of epochs |
changed_params |
list of arguments to change compared to original training setup, see |
a model of class cito.dnn same as created by dnn
if(torch::torch_is_installed()){
library(cito)
set.seed(222)
validation_set<- sample(c(1:nrow(datasets::iris)),25)
# Build and train Network
nn.fit<- dnn(Sepal.Length~., data = datasets::iris[-validation_set,], epochs = 32)
# continue training for another 32 epochs
nn.fit<- continue_training(nn.fit,epochs = 32)
# Use model on validation set
predictions <- predict(nn.fit, iris[validation_set,])
}