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))

