Description Usage Arguments Details Value References See Also
A local version of a single-hidden-layer neural network for classification that puts increased emphasis on a good model fit near the decision boundary.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | dannet(x, ...)
## S3 method for class 'formula'
dannet(formula, data, weights, ...,
subset, na.action, contrasts = NULL)
## S3 method for class 'data.frame'
dannet(x, ...)
## S3 method for class 'matrix'
dannet(x, y, weights = rep(1, nrow(x)),
..., subset, na.action = na.fail)
## Default S3 method:
dannet(x, y,
wf = c("biweight", "cauchy", "cosine", "epanechnikov", "exponential", "gaussian", "optcosine", "rectangular", "triangular"),
bw, k, nn.only, itr = 3, weights = rep(1, nrow(x)),
...)
|
formula |
A formula of the form |
data |
A |
x |
(Required if no |
y |
(Required if no |
weights |
Initial observation weights (defaults to a vector of 1s). |
wf |
A window function which is used to calculate
weights that are introduced into the fitting process.
Either a character string or a function, e.g. |
bw |
(Required only if |
k |
(Required only if |
nn.only |
(Required only if |
itr |
Number of iterations for model fitting, defaults to 3. See also the Details section. |
... |
Further arguments to
|
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 first the
|
contrasts |
A list of contrasts to be used for some or all of the factors appearing as variables in the model formula. |
The idea of Hand and Vinciotti (2003) to put increased
weight on observations near the decision boundary is
generalized to the multiclass case and applied to neural
networks. Since the decision boundary is not known in
advance an iterative procedure is required. First, an
unweighted neural network is fitted to the data. Based on
the differences between the two largest estimated
posterior probabilities observation weights are
calculated. Then a weighted neural network (see
nnet
) from package nnet is
fitted using these weights. Calculation of weights and
model fitting is done several times in turn. The number
of iterations is determined by the itr
-argument
that defaults to 3.
The name of the window function (wf
) can be
specified as a character string. In this case the window
function is generated internally in dalda
.
Currently supported are "biweight"
,
"cauchy"
, "cosine"
, "epanechnikov"
,
"exponential"
, "gaussian"
,
"optcosine"
, "rectangular"
and
"triangular"
.
Moreover, it is possible to generate the window functions
mentioned above in advance (see
wfs
) and pass them to
dalda
.
Any other function implementing a window function can
also be used as wf
argument. This allows the user
to try own window functions. See help on
wfs
for details.
If the predictor variables include factors, the formula interface must be used in order to get a correct model matrix.
In contrast to nnet
this function is
only appropriate for classification problems. As response
in formula
only factors are allowed. If the
response is not a factor, it is coerced to a factor with
a warning. An appropriate classification network is
constructed; this has one output and entropy fit if the
number of levels is two, and a number of outputs equal to
the number of classes and a softmax output stage for more
levels. If you use the default method, you get only
meaningful results if y
is a 0-1 class indicator
matrix.
Optimization is done via the BFGS method of
optim
.
An object of class "dannet"
or
"dannet.formula"
inheriting from "nnet"
. A
list
mostly containing internal structure, but
with the following components:
wts |
The best set of weights found. |
value |
Value of fitting criterion plus weight decay term. |
fitted.values |
The fitted values for the training data. |
residuals |
The residuals for the training data. |
convergence |
1 if the maximum number of iterations was reached, otherwise 0. |
weights |
A list of length |
itr |
The number of iterations used. |
wf |
The window function used. Always a function, even if the input was a string. |
bw |
(Only if |
k |
(Only if |
nn.only |
(Logical. Only if |
adaptive |
(Logical.)
|
call |
The (matched) function call. |
Hand, D. J., Vinciotti, V. (2003), Local versus global models for classification problems: Fitting models where it matters, The American Statistician, 57(2) 124–130.
Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
predict.dannet
, nnet
and dalr
for discriminant adaptive logistic
regression.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.