Learn R Programming

neuralGAM (version 2.0.1)

validate_loss: Validate/resolve a Keras loss

Description

Validate/resolve a Keras loss

Usage

validate_loss(loss)

Value

a callable loss (Python callable) or the original R function.

Arguments

loss

character or function. If character, must be a valid tf.keras loss identifier (e.g., "mse", "mae", "huber", "logcosh", ...).

Examples

Run this code
if (FALSE) {
library(neuralGAM)
L <- neuralGAM:::validate_loss("huber")             # ok (Huber with default delta)
L <- neuralGAM:::validate_loss(function(y,t) tensorflow::tf$reduce_mean((y-t)^2))  # custom
}

Run the code above in your browser using DataLab