powered by
This function implements cross entropy loss used for logistic regression in the form required by EmpiricalRiskMinimizationDP.CMS.
EmpiricalRiskMinimizationDP.CMS
loss.cross.entropy(y.hat, y)
Vector or matrix of the cross entropy loss for each element of y.hat and y.
Vector or matrix of estimated labels.
Vector or matrix of true labels.
y.hat <- c(0.1, 0.88, 0.02) y <- c(0, 1, 0) loss.cross.entropy(y.hat,y)
Run the code above in your browser using DataLab