Function for nearest mean classification.
1 2 3 4 5 6 7 8 9 10 |
x |
matrix or data frame containing the explanatory variables
(required, if |
grouping |
factor specifying the class for each observation
(required, if |
formula |
formula of the form |
data |
Data frame from which variables specified in |
gamma |
gamma parameter for rbf weight of the distance to mean. If |
subset |
An index vector specifying the cases to be used in the training sample. (Note: If given, this argument must be named!) |
na.action |
specify the action to be taken if |
... |
further arguments passed to the underlying |
nm
is calling sknn
with the class means as observations.
If gamma>0
a gaussian like density is used to weight the distance to the class means
weight=exp(-gamma*distance)
. This is similar to an rbf kernel.
If the distances are large it may be useful to scale
the data first.
A list containing the function call and the class means (learn
)).
Karsten Luebke, karsten.luebke@fom.de
1 2 3 4 5 |
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.