cross_entropy_loss: cross_entropy_loss

View source: R/cross_entropy_loss.R

cross_entropy_lossR Documentation

cross_entropy_loss

Description

Computes cross entropy loss.

Usage

cross_entropy_loss(predictions, targets, epsilon = 1e-12,
  log_epsilon = 1e-10)

Arguments

predictions

one-hot encoded proba matrix (with (n,k)).

targets

one-hot encoded matrix (with (n,k)).

epsilon

clipping offset.

log_epsilon

log offset.

Value

numeric loss.

Examples

## Not run: 
cross_entropy_loss(matrix(c(0.25,0.01,0.25,0.01,0.25,0.01,0.25,0.96), nrow = 2),
                   matrix(c(0,0,0,0,0,0,1,1), nrow=2))

## End(Not run)


anderslaunerbaek/homemade documentation built on Sept. 18, 2022, 6:47 a.m.