classify                 package:emu                 R Documentation

_c_l_a_s_s_i_f_y

_D_e_s_c_r_i_p_t_i_o_n:

     classifies data

_U_s_a_g_e:

     classify(data, train, metric = "bayes")

_A_r_g_u_m_e_n_t_s:

    data: data to classify

   train: training data

  metric: bayes or mahal

_V_a_l_u_e:

     The calssification matrix.

_A_u_t_h_o_r(_s):

     Jonathan Harrington

_E_x_a_m_p_l_e_s:

     ## The function is currently defined as
     function (data, train, metric = "bayes") 
     {
         probs <- distance(data, train, metric = metric)
         if (metric == "bayes") {
             best <- apply(probs, 1, max)
         }
         else if (metric == "mahal") {
             best <- apply(probs, 1, min)
         }
         result <- rep("", length(best))
         for (lab in 1:length(train$label)) {
             tmp <- probs[, lab] == best
             result[tmp] <- train$label[lab]
         }
         result
       }

