Description Usage Arguments Value Examples
Sigmoid focal crossentropy loss
1 2 3 4 5 6 7 | loss_sigmoid_focal_crossentropy(
from_logits = FALSE,
alpha = 0.25,
gamma = 2,
reduction = tf$keras$losses$Reduction$NONE,
name = "sigmoid_focal_crossentropy"
)
|
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. |
Weighted loss float 'Tensor'. If 'reduction' is 'NONE',this has the same shape as 'y_true'; otherwise, it is scalar.
1 2 3 4 5 6 7 8 9 10 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.