Learn R Programming

DPpack (version 0.2.2)

generate.loss.huber: Generator for Huber Loss Function

Description

This function generates and returns the Huber loss function used for privacy-preserving SVM at the specified value of h in the form required by EmpiricalRiskMinimizationDP.CMS.

Usage

generate.loss.huber(h)

Value

Huber loss function with parameter h in the form required by EmpiricalRiskMinimizationDP.CMS.

Arguments

h

Positive real number for the Huber loss parameter. Lower values more closely approximate hinge loss. Higher values produce smoother Huber loss functions.

Examples

Run this code
  h <- 0.5
  huber <- generate.loss.huber(h)
  y.hat <- c(-.5, 1.2, -0.9)
  y <- c(-1, 1, -1)
  huber(y.hat,y)
  huber(y.hat, y, w=c(0.1, 0.5, 1)) # Weights observation-level loss

Run the code above in your browser using DataLab