build: Train a Keras Model

Description Usage Arguments Value

View source: R/4-build.R

Description

This wrapper automatically compiles and fits a model on the provided training data. Loss is selected automatically for each output using type2loss.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
build(
  model,
  x_train,
  y_train,
  lr = 0.001,
  loss = NULL,
  loss_weights = NULL,
  epochs = 30,
  batch_size = 128,
  early_stopping_monitor = "val_loss",
  early_stopping_patience = 5,
  reduce_lr_monitor = "val_loss",
  reduce_lr_patience = epochs,
  validation_split = 0.2
)

Arguments

model

A keras model.

x_train, y_train

A numeric or list of numerics. Arguments passed to keras::fit.

lr, loss_weights

Arguments passed to keras::compile.

loss

A list of losses, one for each y_train. If set to NULL, program will choose loss automatically based on y_train. Argument passed to keras::compile.

epochs, batch_size, validation_split

Arguments passed to keras::fit.

early_stopping_monitor, early_stopping_patience

Arguments passed to keras::callback_early_stopping.

reduce_lr_monitor, reduce_lr_patience

Arguments passed to keras::callback_reduce_lr_on_plateau.

Value

This function returns the history. The model is updated in situ.


tpq/caress documentation built on March 11, 2021, 8:03 p.m.