LMSquareLossL2penalties: Linear model with L2 penalties and square loss

Description Usage Arguments Value Examples

Description

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

Usage

1
LMSquareLossL2penalties(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
data(ozone, package = "ElemStatLearn")
y.vec <- ozone[, 1]
X.mat <- as.matrix(ozone[,-1])
W.mat <- LMSquareLossL2penalties(X.mat, y.vec,seq(5, 0.1, by = -0.1))

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