EkNNfit {evclass} | R Documentation |
Training of the EkNN classifier
Description
EkNNfit
optimizes the parameters of the EkNN classifier.
Usage
EkNNfit(
x,
y,
K,
param = NULL,
alpha = 0.95,
lambda = 1/max(as.numeric(y)),
optimize = TRUE,
options = list(maxiter = 300, eta = 0.1, gain_min = 1e-06, disp = TRUE)
)
Arguments
x |
Input matrix of size n x d, where n is the number of objects and d the number of attributes. |
y |
Vector of class labels (of length n). May be a factor, or a vector of integers from 1 to M (number of classes). |
K |
Number of neighbors. |
param |
Initial parameters (default: NULL). |
alpha |
Parameter |
lambda |
Parameter of the cost function. If |
optimize |
Boolean. If TRUE (default), the parameters are optimized. |
options |
A list of parameters for the optimization algorithm: maxiter (maximum number of iterations), eta (initial step of gradient variation), gain_min (minimum gain in the optimisation loop), disp (Boolean; if TRUE, intermediate results are displayed during the optimization). |
Details
If the argument param
is not supplied, the function EkNNinit
is called.
Value
A list with five elements:
- param
The optimized parameters.
- cost
Final value of the cost function.
- err
Leave-one-out error rate.
- ypred
Leave-one-out predicted class labels (coded as integers from 1 to M).
- m
Leave-one-out predicted mass functions. The first M columns correspond to the mass assigned to each class. The last column corresponds to the mass assigned to the whole set of classes.
Author(s)
Thierry Denoeux.
References
T. Denoeux. A k-nearest neighbor classification rule based on Dempster-Shafer theory. IEEE Transactions on Systems, Man and Cybernetics, 25(05):804–813, 1995.
L. M. Zouhal and T. Denoeux. An evidence-theoretic k-NN rule with parameter optimization. IEEE Transactions on Systems, Man and Cybernetics Part C, 28(2):263–271,1998.
See Also
Examples
## Iris dataset
data(iris)
x<-iris[,1:4]
y<-iris[,5]
fit<-EkNNfit(x,y,K=5)