
Loss functions for binary classification
logisticLoss(x, y, loss.weights = 1)rocLoss(x, y)
fbetaLoss(x, y, beta = 1)
hingeLoss(x, y, loss.weights = 1)
matrix of training instances (one instance by row)
a logical vector representing the training labels for each instance in x
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.
a numeric value setting the beta parameter is the f-beta score
a function taking one argument w and computing the loss value and the gradient at point w
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)
Teo et al. A Scalable Modular Convex Solver for Regularized Risk Minimization. KDD 2007
nrbm
# 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