Description Usage Arguments Value Examples
This function uses cross fold validatoion to find the percision of the NNetEarlyStoppingCV function
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)
|
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] |
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.