LMLogisticLossL2: Linear model L2 regularization with logistic loss, including...

Description Usage Arguments Value Examples

Description

Training by using L2 regularization on a linear model with logistic loss . Return the optimal weight vector for the given threshold and penalty.

Usage

1
2
LMLogisticLossL2(X.scaled.mat, y.vec, penalty, opt.thresh,
  initial.weight.vec, step.size = 0.01, max.iteration = 10)

Arguments

X.scaled.mat

a numeric matrix of size [n x p]

y.vec

a numeric matrix of length nrow(X.scaled.mat)

penalty

a non-negative numeric scalar

opt.thresh

a positive numeric scalar

initial.weight.vec

a numeric vector of size ncol(X.scaled.mat)

step.size

a numeric scalar greater than zero

max.iteration

a integer scalar greater than one

Value

opt.weight the optimal weight vector of length ncol(X.scaled)

Examples

1
2
3
4
5
6
data(spam, package = "ElemStatLearn")
X.mat <- as.matrix(spam[, 1:57])
X.scaled.mat <- scale(X.mat)
y.vec <- ifelse(spam$spam == "spam", 1, -1)
opt.weight.vec <- LMLogisticLossL2(X.mat, y.vec, 0.5, 0.5, rep(0,ncol(X.scaled.mat) + 1), 0.01, 100L)
(opt.weight.vec)

SixianZhang/CS499-Coding-Project-2 documentation built on May 26, 2019, 3:31 p.m.