gelnet.logreg.obj {gelnet}R Documentation

Logistic regression objective function value

Description

Evaluates the logistic regression objective function value for a given model. See details. Computes the objective function value according to

-\frac{1}{n} \sum_i y_i s_i - \log( 1 + \exp(s_i) ) + R(w)

where

s_i = w^T x_i + b

R(w) = \lambda_1 \sum_j d_j |w_j| + \frac{\lambda_2}{2} (w-m)^T P (w-m)

When balanced is TRUE, the loss average over the entire data is replaced with averaging over each class separately. The total loss is then computes as the mean over those per-class estimates.

Usage

gelnet.logreg.obj(w, b, X, y, l1, l2, d = rep(1, ncol(X)),
  P = diag(ncol(X)), m = rep(0, ncol(X)), balanced = FALSE)

Arguments

w

p-by-1 vector of model weights

b

the model bias term

X

n-by-p matrix of n samples in p dimensions

y

n-by-1 binary response vector sampled from 0,1

l1

L1-norm penalty scaling factor \lambda_1

l2

L2-norm penalty scaling factor \lambda_2

d

p-by-1 vector of feature weights

P

p-by-p feature-feature penalty matrix

m

p-by-1 vector of translation coefficients

balanced

boolean specifying whether the balanced model is being evaluated

Value

The objective function value.

See Also

gelnet


[Package gelnet version 1.2.1 Index]