condense                package:class                R Documentation

_C_o_n_d_e_n_s_e _t_r_a_i_n_i_n_g _s_e_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:

     Condense training set for k-NN classifier

_U_s_a_g_e:

     condense(train, class, store, trace = TRUE)

_A_r_g_u_m_e_n_t_s:

   train: matrix for training set 

   class: vector of classifications for test set 

   store: initial store set. Default one randomly chosen element of the
          set. 

   trace: logical. Trace iterations? 

_D_e_t_a_i_l_s:

     The store set is used to 1-NN classify the rest, and misclassified
     patterns are added to the store set. The whole set is checked
     until no additions occur.

_V_a_l_u_e:

     index vector of cases to be retained (the final store set).

_R_e_f_e_r_e_n_c_e_s:

     P. A. Devijver and J. Kittler (1982) _Pattern Recognition. A
     Statistical Approach._ Prentice-Hall, pp. 119-121.

     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:

     'reduce.nn', 'multiedit'

_E_x_a_m_p_l_e_s:

     train <- rbind(iris3[1:25,,1], iris3[1:25,,2], iris3[1:25,,3])
     test <- rbind(iris3[26:50,,1], iris3[26:50,,2], iris3[26:50,,3])
     cl <- factor(c(rep("s",25), rep("c",25), rep("v",25)))
     keep <- condense(train, cl)
     knn(train[keep, , drop=FALSE], test, cl[keep])
     keep2 <- reduce.nn(train, keep, cl)
     knn(train[keep2, , drop=FALSE], test, cl[keep2])

