reduce.nn               package:class               R Documentation

_R_e_d_u_c_e _T_r_a_i_n_i_n_g _S_e_t _f_o_r _a _k-_N_N _C_l_a_s_s_i_f_i_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     Reduce training set for a k-NN classifier. Used after `condense'.

_U_s_a_g_e:

     reduce.nn(train, ind, class)

_A_r_g_u_m_e_n_t_s:

   train: matrix for training set 

     ind: Initial list of members of the training set (from
          `condense'). 

   class: vector of classifications for test set 

_D_e_t_a_i_l_s:

     All the members of the training set are tried in random order. Any
     which when dropped do not cause any members of the training set to
     be wrongly classified are dropped.

_V_a_l_u_e:

     index vector of cases to be retained.

_R_e_f_e_r_e_n_c_e_s:

     Gates, G.W. (1972) The reduced nearest neighbor rule. IEEE Trans.
     Information Theory IT-18, 431-432.

_S_e_e _A_l_s_o:

     `condense', `multiedit'

_E_x_a_m_p_l_e_s:

     data(iris3)
     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,], test, cl[keep])
     keep2 <- reduce.nn(train, keep, cl)
     knn(train[keep2,], test, cl[keep2])

