multivariateHingeLoss: The loss function for multivariate hinge loss

Description Usage Arguments Value See Also Examples

Description

The loss function for multivariate hinge loss

Usage

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

Arguments

x

matrix of training instances (one instance by row)

y

logical matrix of targets: y(t,) is the vector of binary labels for x(t,)

loss.weights

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

Value

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

See Also

nrbm

Examples

1
2
3
4
5
6
7
8
9
  x <- cbind(intercept=100,data.matrix(iris[1:4]))
  y <- model.matrix(~iris$Species+0)>0
  w <- nrbm(multivariateHingeLoss(x,y),LAMBDA=1)
  table(y,predict(w,x)>0,col(y))
  table(
    do.call(paste0,as.data.frame(y+0)),
    do.call(paste0,as.data.frame((predict(w,x)>0)+0))
  )
  

bmrm documentation built on May 2, 2019, 2:49 p.m.