Cross-validation for a Neural Network

cv.nn(
  object,
  K = 5,
  repeats = 1,
  decay = seq(0, 1, 0.2),
  size = 1:5,
  seed = 1234,
  trace = TRUE,
  fun,
  ...
)

Arguments

object

Object of type "nn" or "nnet"

K

Number of cross validation passes to use

repeats

Repeated cross validation

decay

Parameter decay

size

Number of units (nodes) in the hidden layer

seed

Random seed to use as the starting point

trace

Print progress

fun

Function to use for model evaluation (i.e., auc for classification and RMSE for regression)

...

Additional arguments to be passed to 'fun'

Value

A data.frame sorted by the mean of the performance metric

Details

See https://radiant-rstats.github.io/docs/model/nn.html for an example in Radiant

See also

nn to generate an initial model that can be passed to cv.nn

Rsq to calculate an R-squared measure for a regression

RMSE to calculate the Root Mean Squared Error for a regression

MAE to calculate the Mean Absolute Error for a regression

auc to calculate the area under the ROC curve for classification

profit to calculate profits for classification at a cost/margin threshold

Examples

if (FALSE) { result <- nn(dvd, "buy", c("coupon", "purch", "last")) cv.nn(result, decay = seq(0, 1, .5), size = 1:2) cv.nn(result, decay = seq(0, 1, .5), size = 1:2, fun = profit, cost = 1, margin = 5) result <- nn(diamonds, "price", c("carat", "color", "clarity"), type = "regression") cv.nn(result, decay = seq(0, 1, .5), size = 1:2) cv.nn(result, decay = seq(0, 1, .5), size = 1:2, fun = Rsq) }