Calculate the NNET Result with the Smallest Value from Various Random Starts

Share:

Description

This function provides the best solution from various calls to the nnet feed-forward artificial neural networks function (nnet).

Usage

1
nnetrandom(formula,data,tries=10,leave.one.out=F,...)

Arguments

formula

Formula as passed to nnet.

data

Data as passed to nnet.

tries

Number of calls to nnet to obtain the best solution.

leave.one.out

Calculate leave-one-out predictions.

...

Other arguments passed to nnet.

Details

This function makes various calls to nnet. If desired by the user, leave-one-out statistics are provided that report the prediction if one particular sample unit was not used for iterating the networks.

Value

The function returns the same components as nnet, but adds the following components:

range

Summary of the observed "values".

tries

Number of different attempts to iterate an ANN.

CV

Predicted class when not using the respective sample unit for iterating ANN.

succesful

Test whether leave-one-out statistics provided the same class as the original class.

Author(s)

Roeland Kindt (World Agroforestry Centre)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
data(faramea)
faramea <- na.omit(faramea)
faramea$presence <- as.numeric(faramea$Faramea.occidentalis > 0)
attach(faramea)
library(nnet)
result <- nnetrandom(presence ~ Elevation, data=faramea, size=2, 
    skip=FALSE, entropy=TRUE, trace=FALSE, maxit=1000, tries=100, 
    leave.one.out=FALSE)
summary(result)
result$fitted.values
result$value
result2 <- nnetrandom(presence ~ Elevation, data=faramea, size=2, 
    skip=FALSE, entropy=TRUE, trace=FALSE, maxit=1000, tries=50, 
    leave.one.out=TRUE)
result2$range
result2$CV
result2$successful

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.