# avNNet.default

From caret v5.15-045
by Max Kuhn

##### Neural Networks Using Model Averaging

Aggregate several neural network model

- Keywords
- neural

##### Usage

```
## S3 method for class 'default':
avNNet(x, y, repeats = 5, bag = FALSE, ...)
## S3 method for class 'formula':
avNNet(formula, data, weights, ...,
repeats = 5, bag = FALSE, subset, na.action, contrasts = NULL)
```## S3 method for class 'avNNet':
predict(object, newdata, type = c("raw", "class", "prob"), ...)

##### Arguments

- formula
- A formula of the form
`class ~ x1 + x2 + ...`

- x
- matrix or data frame of
`x`

values for examples. - y
- matrix or data frame of target values for examples.
- weights
- (case) weights for each example -- if missing defaults to 1.
- repeats
- the number of neural networks with with different random number seeds
- bag
- a logical for bagging for each repeat
- data
- Data frame from which variables specified in
`formula`

are preferentially to be taken. - subset
- An index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.)
- na.action
- A function to specify the action to be taken if
`NA`

s are found. The default action is for the procedure to fail. An alternative is na.omit, which leads to rejection of cases with missing values on any required variable. (NOTE: If given, this - contrasts
- a list of contrasts to be used for some or all of the factors appearing as variables in the model formula.
- object
- an object of class
`avNNet`

as returned by`avNNet`

. - newdata
- matrix or data frame of test examples. A vector is considered to be a row vector comprising a single case.
- type
- Type of output, either:
`raw`

for the raw outputs,`code`

for the predicted class or`prob`

for the class probabilities. - ...
- arguments passed to
`nnet`

##### Details

Following Ripley (1996), the same neural network model is fit using different random number seeds. All of the resulting models are used for prediction. For regression, the output from each network are averaged. For classification, the model scores are first averaged, then translated to predicted classes. Bagging can also be used to create the models.

##### Value

- For
`avNNet`

, an object of`"avNNet"`

or`"avNNet.formula"`

. Items of interest in the output are: model a list of the models generated from `nnet`

repeats an echo of the model input names if any predictors had only one distinct value, this is a character string of the remaining columns. Otherwise a value of `NULL`

##### References

Ripley, B. D. (1996)
*Pattern Recognition and Neural Networks.* Cambridge.

##### See Also

##### Examples

```
data(BloodBrain)
modelFit <- avNNet(bbbDescr, logBBB, size = 5, linout = TRUE, trace = FALSE)
modelFit
predict(modelFit, bbbDescr)
```

*Documentation reproduced from package caret, version 5.15-045, License: GPL-2*

### Community examples

Looks like there are no examples yet.