multiedit               package:class               R Documentation

_M_u_l_t_i_e_d_i_t _f_o_r _k-_N_N _C_l_a_s_s_i_f_i_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     Multiedit for k-NN classifier

_U_s_a_g_e:

     multiedit(x, class, k = 1, V = 3, I = 5, trace = TRUE)

_A_r_g_u_m_e_n_t_s:

       x: matrix of training set. 

   class: vector of classification of training set. 

       k: number of neighbours used in k-NN. 

       V: divide training set into V parts. 

       I: number of null passes before quitting. 

   trace: logical for statistics at each pass. 

_V_a_l_u_e:

     index vector of cases to be retained.

_R_e_f_e_r_e_n_c_e_s:

     P. A. Devijver and J. Kittler (1982) _Pattern Recognition. A
     Statistical Approach._ Prentice-Hall, p. 115.

     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.

_S_e_e _A_l_s_o:

     'condense', 'reduce.nn'

_E_x_a_m_p_l_e_s:

     data(iris3)
     tr <- sample(1:50, 25)
     train <- rbind(iris3[tr,,1], iris3[tr,,2], iris3[tr,,3])
     test <- rbind(iris3[-tr,,1], iris3[-tr,,2], iris3[-tr,,3])
     cl <- factor(c(rep(1,25),rep(2,25), rep(3,25)), labels=c("s", "c", "v"))
     table(cl, knn(train, test, cl, 3))
     ind1 <- multiedit(train, cl, 3)
     length(ind1)
     table(cl, knn(train[ind1, , drop=FALSE], test, cl[ind1], 1))
     ntrain <- train[ind1,]; ncl <- cl[ind1]
     ind2 <- condense(ntrain, ncl)
     length(ind2)
     table(cl, knn(ntrain[ind2, , drop=FALSE], test, ncl[ind2], 1))

