

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

_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.

_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 Recogni-
     tion. A Statistical Approach.  Prentice-Hall, pp.
     119-121.

_S_e_e _A_l_s_o_:

     `reduce.nn', `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])

