LMSquareLossIterations: Linear model iteration with square loss

Description Usage Arguments Value Examples

Description

Training by using gradient descent on a linear model with square loss . Return a matrix of weight vector for each iteration to the max iteration.

Usage

1
LMSquareLossIterations(X.mat, y.vec, max.iterations, step.size = 0.5)

Arguments

X.mat

train feature matrix of size [n x p]

y.vec

train label vector of size [n x 1]

max.iterations

integer scalar greater than 1

step.size

integer scalar

Value

W.mat matrix of weight vectors of size [(p + 1) x max.iterations]. A prediction can be obtained by cbind(1,X.mat)

Examples

1
2
3
4
data(ozone, package = "ElemStatLearn")
y.vec <- ozone[, 1]
X.mat <- as.matrix(ozone[,-1])
W.mat <- LMSquareLossIterations(X.mat, y.vec, max.iterations = 5L)

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