NNetEarlyStoppingCV: NNetEarlyStoppingCV

Description Usage Arguments Value Examples

Description

This function uses cross fold validatoion to find the percision of the NNetEarlyStoppingCV function

Usage

1
2
NNetEarlyStoppingCV(X.mat, y.vec, fold.vec = sample(rep(1:4, l =
  nrow(X.mat))), max.iterations, step.size, n.hidden.units, n.folds = 4)

Arguments

X.mat

numeric input feature matrix [n x p]

fold.vec

a vector of fold ids

max.iterations

scalar integer, max number of iterations

n.hidden.units

The number of hidden units, U

Y.vec

numeric input label vetor [n]

Value

Output: list with named elements: pred.mat n_observations x max.iterations matrix of predicted values (real number for regression, probability for binary classification). V.mat final weight matrix (n_features+1 x n.hidden.units). The first row of V.mat should be the intercept terms. w.vec final weight vector (n.hidden.units+1). The first element of w.vec should be the intercept term. predict(testX.mat) a function that takes an unscaled test feature matrix and returns a vector of predictions (real numbers for regression, probabilities for binary classification). mean.validation.loss mean.train.loss.vec (for plotting train/validation loss curves) selected.steps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
   library(CodingProject3)

   data(ozone , package = "ElemStatLearn")
   X.mat<-as.matrix(ozone [,-1])
   y.vec<-as.numeric(ozone [, 1])
   max.iterations <- 100
   fold.vec <- sample(rep(1:4, l=nrow(X.mat)))
   step.size <- 0.1
   n.hidden.units <- 2
   result <- NNetEarlyStoppingCV(X.mat, y.vec, fold.vec, max.iterations, step.size, n.hidden.units)

mertayD/CodingProject3 documentation built on May 14, 2019, 3:07 a.m.