EkNNfit
optimizes the parameters of the EkNN classifier.
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)
)
A list with five elements:
The optimized parameters.
Final value of the cost function.
Leave-one-out error rate.
Leave-one-out predicted class labels (coded as integers from 1 to 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.
Input matrix of size n x d, where n is the number of objects and d the number of attributes.
Vector of class labels (of length n). May be a factor, or a vector of integers from 1 to M (number of classes).
Number of neighbors.
Initial parameters (default: NULL).
Parameter \(\alpha\) (default: 0.95)
Parameter of the cost function. If lambda=1
, the
cost function measures the error between the plausibilities and the 0-1 target values.
If lambda=1/M
, where M is the number of classes (default), the piginistic probabilities
are considered in the cost function. If lambda=0
, the beliefs are used.
Boolean. If TRUE (default), the parameters are optimized.
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).
Thierry Denoeux.
If the argument param
is not supplied, the function EkNNinit
is called.
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.
EkNNinit
, EkNNval
## Iris dataset
data(iris)
x<-iris[,1:4]
y<-iris[,5]
fit<-EkNNfit(x,y,K=5)
Run the code above in your browser using DataLab