MB Affinity Tool

The MB Affinity tool takes "transaction" data and constructs a matrix where each row is a transaction and the columns are the set of "items" that could appear in the transaction. If an item was present in a transaction, it has a value of 1 in the matrix, and 0 if it did not. The matrix is then used to construct a matrix of affinity measures between different items with respect to their likelihood of being in the same transaction. As a result, if there are 500 items, the resulting matrix will have 500 rows and columns.

This tool scales with the number of transactions records, but is limited in the number of unique items it can handle. Using common laptop and desktop configurations, the limit is likely to be between 3,000 and 5,000 unique items.

This tool uses the R tool. Go to Options > Download Predictive Tools and sign in to the Alteryx Downloads and Licenses portal to install R and the packages used by the R Tool. See Download and Use Predictive Tools.

Configure the tool

  1. Select the transaction key field: The selected field must be numeric and should contain IDs for the transactions.
  2. Select the field that contains the item identifier: The selected field should contain names or IDs for the items (to be compared)
  3. Affinity measure
    • Cosine distance: A measure of distance (i.e. dissimilarity) between two items - between 0 (most similar) and 1 (least similar).
    • Cosine similarity: A measure of similarity between two items - between 0 (least similar) and 1 (most similar).
    • Co-occurrence: A count - the number of transactions in which both items were present
  4. Number of records per data chunk: Maximum number of records to be processed simultaneously.

*https://en.wikipedia.org/wiki/Cosine_similarity