loss_sigmoid_focal_crossentropy {tfaddons} | R Documentation |
Sigmoid focal crossentropy loss
Description
Sigmoid focal crossentropy loss
Usage
loss_sigmoid_focal_crossentropy(
from_logits = FALSE,
alpha = 0.25,
gamma = 2,
reduction = tf$keras$losses$Reduction$NONE,
name = "sigmoid_focal_crossentropy"
)
Arguments
from_logits |
If logits are provided then convert the predictions into probabilities |
alpha |
balancing factor. |
gamma |
modulating factor. |
reduction |
(Optional) Type of tf$keras$losses$Reduction to apply. Default value is SUM_OVER_BATCH_SIZE. |
name |
(Optional) name for the loss. |
Value
Weighted loss float 'Tensor'. If 'reduction' is 'NONE',this has the same shape as 'y_true'; otherwise, it is scalar.
Examples
## Not run:
keras_model_sequential() %>%
layer_dense(4, input_shape = c(784)) %>%
compile(
optimizer = 'sgd',
loss=loss_sigmoid_focal_crossentropy(),
metrics='accuracy'
)
## End(Not run)
[Package tfaddons version 0.10.0 Index]