LMLogisticLossEarlyStoppingCV: Cross validation algorithm using linear model with logistic...

Description Usage Arguments Value Examples

Description

Training by using cross validation on a linear model with logistic 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
2
LMLogisticLossEarlyStoppingCV(X.mat, y.vec, fold.vec = NULL,
  max.iteration, 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]

fold.vec

fold index vector of size [n x 1]

max.iteration

integer scalar greater than 1

step.size

a numeric scaler greater than 0, default is 0.5

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(spam, package = "ElemStatLearn")
X.mat <- as.matrix(spam[, 1:57])
y.vec <- ifelse(spam$spam == "spam", 1, 0)
earlystopping.list <- LMLogisticLossEarlyStoppingCV(X.mat, y.vec, NULL, 100L, 0.5)
(earlystopping.list$predict(as.matrix(X.mat[c(2,4),])))

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