Provides the generic function affinity and the S4 method
to compute and return a matrix with the affinities between items
for a set of transactions.
Usage
affinity(x)
## S3 method for class 'itemMatrix':
affinity(x)
Arguments
x
an object of class "itemMatrix".
Value
returns an object of class "matrix" which represents
the affinities (similarities) between items in x.
Details
Affinity between the two items $i$ and $j$ is defined as
$$A(i,j) = \frac{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.
References
Charu C. Aggarwal, Cecilia Procopiuc, and Philip S. Yu.
Finding localized associations in market basket data.
IEEE Trans. on Knowledge and Data Engineering, 14(1):51-62, 2002.