train.nnet: train.nnet

Description Usage Arguments Value Note See Also Examples

View source: R/train.R

Description

Provides a wrapping function for the nnet.

Usage

1
2

Arguments

formula

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

data

Data frame from which variables specified in formula are preferentially to be taken.

weights

(case) weights for each example – if missing defaults to 1.

...

arguments passed to or from other methods.

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 NAs 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 argument must be named.)

contrasts

a list of contrasts to be used for some or all of the factors appearing as variables in the model formula.

Value

A object nnet.prmdt with additional information to the model that allows to homogenize the results.

Note

the parameter information was taken from the original function nnet.

See Also

The internal function is from package nnet.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data("iris")

n <- seq_len(nrow(iris))
.sample <- sample(n, length(n) * 0.75)
data.train <- iris[.sample,]
data.test <- iris[-.sample,]

modelo.nn <- train.nnet(Species~., data.train, size = 20)
modelo.nn
prob <- predict(modelo.nn, data.test, type = "prob")
prob
prediccion <- predict(modelo.nn, data.test, type = "class")
prediccion
confusion.matrix(data.test, prediccion)

PROMiDAT/trainR documentation built on Oct. 27, 2020, 8:33 p.m.