affinity

0th

Percentile

Computing Affinity Between Items

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.

Keywords
models, cluster
Usage
affinity(x)
Arguments
x

a matrix or an object of class itemMatrix or transactions.

Details

Affinity between the two items \(i\) and \(j\) is defined by Aggarwal et al. (2002) 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.

Value

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

References

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.

See Also

dissimilarity, ar_similarity-class, itemMatrix-class

Aliases
  • affinity
  • affinity,itemMatrix-method
  • affinity,matrix-method
Examples
# NOT RUN {
data("Adult")

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

a <- affinity(s)
image(a)
# }
Documentation reproduced from package arules, version 1.5-4, License: GPL-3

Community examples

Looks like there are no examples yet.