LMSquareLossEarlyStoppingCV: Cross validation algorithm using linear model with square...

Description Usage Arguments Value Examples

Description

Training by using cross validation on a linear model with square loss and early stopping method. Return a list which contains the best iteration step, mean loss of training and validation data, and a predict function which gives a prediction based on the selected step.

Usage

1
LMSquareLossEarlyStoppingCV(X.mat, y.vec, fold.vec, max.iteration)

Arguments

X.mat

train feature matrix of size [n x p]

y.vec

train label vector of size [n x 1]

fold.vec

the fold vector information of size [n x 1], which is assigned in the general test

max.iteration

integer scalar greater than 1

Value

result.list a list with mean.validation.loss.vec, mean.train.loss.vec,selected.steps,weight.vec,and predict function

Examples

1
2
3
4
5
data(ozone, package = "ElemStatLearn")
y.vec <- ozone[, 1]
X.mat <- as.matrix(ozone[,-1])
result.list <- LMSquareLossEarlyStoppingCV(X.mat, y.vec, NULL, max.iteration = 5L)
result.list$predict(X.mat[c(3,19,20),])

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