affinity               package:arules               R Documentation

_C_o_m_p_u_t_i_n_g _A_f_f_i_n_i_t_y _B_e_t_w_e_e_n _I_t_e_m_s

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

     Provides the generic function 'affinity' and the S4 methods to
     compute and return a similarity matrix with the affinities between
     items   for a set of 'transactions'.

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

     affinity(x)

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

       x: a matrix or an object of class 'itemMatrix'  or
          'transactions'.

_D_e_t_a_i_l_s:

     Affinity between the two items i and j is defined  by Aggarwal et
     al. (2002) as

       A(i,j) = sup({i,j})/(sup({i}) + sup({j}) - sup({i,j})),

     where sup(.) is the support measure. This means that affinity is
     the  _Jaccard similarity_ between items.

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

     returns an object of class 'ar_similarity' which represents the
     affinities between items in 'x'.

_R_e_f_e_r_e_n_c_e_s:

     Charu C. Aggarwal, Cecilia Procopiuc, and Philip S. Yu (2002)
     Finding localized associations in market basket data, _IEEE Trans.
     on Knowledge and Data Engineering,_ 14(1):51-62.

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

     'dissimilarity', 'ar_similarity-class', 'itemMatrix-class'

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

     data("Adult")

     ## choose a sample, calculate affinities 
     s <- sample(Adult, 500)
     s

     a <- affinity(s)
     summary(as.vector(a))

