EkNNfit: Training of the EkNN classifier

View source: R/EkNNfit.R

EkNNfitR 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 \alpha (default: 0.95)

lambda

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.

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

EkNNinit, EkNNval

Examples

## Iris dataset
data(iris)
x<-iris[,1:4]
y<-iris[,5]
fit<-EkNNfit(x,y,K=5)

evclass documentation built on Nov. 9, 2023, 5:08 p.m.