LMLogisticLossL2penalties: Linear model with L2 penalties and logistic loss

Description Usage Arguments Value Examples

Description

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

Usage

1
LMLogisticLossL2penalties(X.mat, y.vec, penalty.vec, opt.thresh = 0.5)

Arguments

X.mat

a numeric matrix of size [n x p]

y.vec

a numeric vector of length nrow(X.mat)

penalty.vec

a non-negative numeric vector

opt.thresh

a non-negative numeric scalar

Value

W.mat a numeric weight matrix of size [ncol(X.mat) x length(penalty.vec)]

Examples

1
2
3
4
5
6
data(spam, package = "ElemStatLearn")
X.mat <- as.matrix(spam[, 1:57])
y.vec <- ifelse(spam$spam == "spam", 1, -1)
penalty.vec <- seq(5,0.1, by = -0.1)
W.mat <- LMLogisticLossL2penalties(X.mat, y.vec, penalty.vec, 0.5)
(W.mat)

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