loss.gr.cross.entropy: Cross Entropy Loss Function Gradient

View source: R/StatModels.R

loss.gr.cross.entropyR Documentation

Cross Entropy Loss Function Gradient

Description

This function implements cross entropy loss gradient with respect to y.hat used for logistic regression in the form required by EmpiricalRiskMinimizationDP.CMS.

Usage

loss.gr.cross.entropy(y.hat, y)

Arguments

y.hat

Vector or matrix of estimated labels.

y

Vector or matrix of true labels.

Value

Vector or matrix of the cross entropy loss gradient for each element of y.hat and y.

Examples

  y.hat <- c(0.1, 0.88, 0.02)
  y <- c(0, 1, 0)
  loss.gr.cross.entropy(y.hat,y)


DPpack documentation built on April 8, 2023, 9:09 a.m.