bmrm (version 4.1)

binaryClassificationLoss: Loss functions for binary classification

Description

Loss functions for binary classification

Usage

logisticLoss(x, y, loss.weights = 1)

rocLoss(x, y)

fbetaLoss(x, y, beta = 1)

hingeLoss(x, y, loss.weights = 1)

Arguments

x

matrix of training instances (one instance by row)

y

a logical vector representing the training labels for each instance in x

loss.weights

numeric vector of loss weights to incure for each instance of x. Vector length should match length(y), but values are cycled if not of identical size.

beta

a numeric value setting the beta parameter is the f-beta score

Value

a function taking one argument w and computing the loss value and the gradient at point w

Functions

  • logisticLoss: logistic regression

  • rocLoss: Find linear weights maximize area under its ROC curve

  • fbetaLoss: F-beta score loss function

  • hingeLoss: Hinge Loss for Linear Support Vector Machine (SVM)

References

Teo et al. A Scalable Modular Convex Solver for Regularized Risk Minimization. KDD 2007

See Also

nrbm

Examples

Run this code
# NOT RUN {
  x <- cbind(intercept=100,data.matrix(iris[1:2]))
  w <- nrbm(hingeLoss(x,iris$Species=="setosa"));predict(w,x)
  w <- nrbm(logisticLoss(x,iris$Species=="setosa"));predict(w,x)
  w <- nrbm(rocLoss(x,iris$Species=="setosa"));predict(w,x)
  w <- nrbm(fbetaLoss(x,iris$Species=="setosa"));predict(w,x)
# }

Run the code above in your browser using DataLab