softmaxLoss: softmax Loss Function

Description Usage Arguments Value References Examples

Description

softmax loss function may be used to predict probability distributions

Usage

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

Arguments

x

instance matrix, where x(t,) defines the features of instance t

y

target matrix where y(t,) is a probability distribution that should sum to 1

loss.weights

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

Value

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

References

Teo et al. Bundle Methods for Regularized Risk Minimization JMLR 2010

Examples

1
2
3
4
5
6
  # -- Load the data
  x <- cbind(intercept=100,data.matrix(iris[1:4]))
  y <- model.matrix(~iris$Species+0)
  w <- nrbm(softmaxLoss(x,y))
  P <- predict(w,x)
  table(max.col(P),iris$Species)

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