The base deep neural network train function (one deep neural network trained without automatic hyperparameters tuning)

automl_train_manual(Xref, Yref, hpar = list(), mdlref = NULL)

Arguments

Xref

inputs matrix or data.frame (containing numerical values only)

Yref

target matrix or data.frame (containing numerical values only)

hpar

list of parameters and hyperparameters for Deep Neural Network, see hpar section
Not mandatory (the list is preset and all arguments are initialized with default value) but it is advisable to adjust some important arguments for performance reasons (including processing time)

mdlref

model trained with automl_train or automl_train_manual to start training from a saved model (shape, weights...) for fine tuning
nb: manually entered parameters above override loaded ones

Examples

##REGRESSION (predict Sepal.Length given other Iris parameters) data(iris) xmat <- cbind(iris[,2:4], as.numeric(iris$Species)) ymat <- iris[,1] #with gradient descent amlmodel <- automl_train_manual(Xref = xmat, Yref = ymat, hpar = list(learningrate = 0.01, numiterations = 30, minibatchsize = 2^2))
#> (cost: mse) #> cost epoch10: 0.07483378655409 (cv cost: 0.466478285718589) (LR: 0.01 ) #> cost epoch20: 0.275546796158403 (cv cost: 0.294895895020273) (LR: 0.01 ) #> cost epoch30: 0.231827727788502 (cv cost: 0.233179461368555) (LR: 0.01 ) #> dim X: [4,135] #> dim W1: [10,4] (min|max: -1.54429770594677, 2.73130744979701) #> dim bB1: [10,1] (min|max: -0.317658298585351, 1.99139261324871) #> dim W2: [1,10] (min|max: -0.313978049365135, 0.286454921099375) #> dim bB2: [1,1] (min|max: 0.337210920487028, 0.337210920487028) #> dim Y: [1,135]
if (FALSE) { #with PSO amlmodel <- automl_train_manual(Xref = xmat, Yref = ymat, hpar = list(modexec = 'trainwpso', numiterations = 30, psopartpopsize = 50)) #with PSO and custom cost function f <- 'J=abs((y-yhat)/y)' f <- c(f, 'J=sum(J[!is.infinite(J)],na.rm=TRUE)') f <- c(f, 'J=(J/length(y))') f <- paste(f, collapse = ';') amlmodel <- automl_train_manual(Xref = xmat, Yref = ymat, hpar = list(modexec = 'trainwpso', numiterations = 30, psopartpopsize = 50, costcustformul = f)) ##CLASSIFICATION (predict Species given other Iris parameters) data(iris) xmat = iris[,1:4] lab2pred <- levels(iris$Species) lghlab <- length(lab2pred) iris$Species <- as.numeric(iris$Species) ymat <- matrix(seq(from = 1, to = lghlab, by = 1), nrow(xmat), lghlab, byrow = TRUE) ymat <- (ymat == as.numeric(iris$Species)) + 0 #with gradient descent and 2 hidden layers amlmodel <- automl_train_manual(Xref = xmat, Yref = ymat, hpar = list(layersshape = c(10, 10, 0), layersacttype = c('tanh', 'relu', 'sigmoid'), layersdropoprob = c(0, 0, 0))) #with gradient descent and no hidden layer (logistic regression) amlmodel <- automl_train_manual(Xref = xmat, Yref = ymat, hpar = list(layersshape = c(0), layersacttype = c('sigmoid'), layersdropoprob = c(0))) #with PSO and softmax amlmodel <- automl_train_manual(Xref = xmat, Yref = ymat, hpar = list(modexec = 'trainwpso', layersshape = c(10, 0), layersacttype = c('relu', 'softmax'), layersdropoprob = c(0, 0), numiterations = 50, psopartpopsize = 50)) }