| continue_training | R Documentation |
dnn for additional epochs.If the training/validation loss is still decreasing at the end of the training, it is often a sign that the NN has not yet converged. You can use this function to continue training instead of re-training the entire model.
continue_training( model, epochs = 32, data = NULL, device = "cpu", verbose = TRUE, changed_params = NULL, parallel = FALSE ) ## S3 method for class 'citodnn' continue_training( model, epochs = 32, data = NULL, device = "cpu", verbose = TRUE, changed_params = NULL, parallel = FALSE ) ## S3 method for class 'citodnnBootstrap' continue_training( model, epochs = 32, data = NULL, device = "cpu", verbose = TRUE, changed_params = NULL, parallel = FALSE )
model |
a model created by |
epochs |
additional epochs the training should continue for |
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 |
parallel |
train bootstrapped model in parallel |
a model of class citodnn or citodnnBootstrap 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,])
}