1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pcaNNet.R
\name{pcaNNet}
\alias{pcaNNet}
\alias{pcaNNet.default}
\alias{predict.pcaNNet}
\alias{pcaNNet.formula}
\alias{print.pcaNNet}
\title{Neural Networks with a Principal Component Step}
\usage{
pcaNNet(x, ...)
\method{pcaNNet}{formula}(
formula,
data,
weights,
...,
thresh = 0.99,
subset,
na.action,
contrasts = NULL
)
\method{pcaNNet}{default}(x, y, thresh = 0.99, ...)
\method{print}{pcaNNet}(x, ...)
\method{predict}{pcaNNet}(object, newdata, type = c("raw", "class", "prob"), ...)
}
\arguments{
\item{x}{matrix or data frame of \code{x} values for examples.}
\item{\dots}{arguments passed to \code{\link[nnet]{nnet}}, such as
\code{size}, \code{decay}, etc.}
\item{formula}{A formula of the form \code{class ~ x1 + x2 + \dots{}}}
\item{data}{Data frame from which variables specified in \code{formula} are
preferentially to be taken.}
\item{weights}{(case) weights for each example - if missing defaults to 1.}
\item{thresh}{a threshold for the cumulative proportion of variance to
capture from the PCA analysis. For example, to retain enough PCA components
to capture 95 percent of variation, set \code{thresh = .95}}
\item{subset}{An index vector specifying the cases to be used in the
training sample. (NOTE: If given, this argument must be named.)}
\item{na.action}{A function to specify the action to be taken if \code{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 argument must be named.)}
\item{contrasts}{a list of contrasts to be used for some or all of the
factors appearing as variables in the model formula.}
\item{y}{matrix or data frame of target values for examples.}
\item{object}{an object of class \code{pcaNNet} as returned by
\code{pcaNNet}.}
\item{newdata}{matrix or data frame of test examples. A vector is considered
to be a row vector comprising a single case.}
\item{type}{Type of output}
}
\value{
For \code{pcaNNet}, an object of \code{"pcaNNet"} or
\code{"pcaNNet.formula"}. Items of interest in the output are: \item{pc
}{the output from \code{\link{preProcess}}} \item{model }{the model
generated from \code{\link[nnet]{nnet}}} \item{names }{if any predictors had
only one distinct value, this is a character string of the remaining
columns. Otherwise a value of \code{NULL}}
}
\description{
Run PCA on a dataset, then use it in a neural network model
}
\details{
The function first will run principal component analysis on the data. The
cumulative percentage of variance is computed for each principal component.
The function uses the \code{thresh} argument to determine how many
components must be retained to capture this amount of variance in the
predictors.
The principal components are then used in a neural network model.
When predicting samples, the new data are similarly transformed using the
information from the PCA analysis on the training data and then predicted.
Because the variance of each predictor is used in the PCA analysis, the code
does a quick check to make sure that each predictor has at least two
distinct values. If a predictor has one unique value, it is removed prior to
the analysis.
}
\examples{
data(BloodBrain)
modelFit <- pcaNNet(bbbDescr[, 1:10], logBBB, size = 5, linout = TRUE, trace = FALSE)
modelFit
predict(modelFit, bbbDescr[, 1:10])
}
\references{
Ripley, B. D. (1996) \emph{Pattern Recognition and Neural
Networks.} Cambridge.
}
\seealso{
\code{\link[nnet]{nnet}}, \code{\link{preProcess}}
}
\author{
These are heavily based on the \code{nnet} code from Brian Ripley.
}
\keyword{neural}
|