Sub topic 11
Counting how often cards are grouped together
This chapter covers the similarity matrix, the table that turns many participants' open sorts into one picture of which cards belong together. It assumes you can run an open card sort, read tables and percentages, and run a short Python script. The next chapter clusters the matrix. This one builds it and shows how to read it.
From groups to pairs
Each participant's sort is a set of groups. A group says little on its own, because participants name and size groups differently. What you can compare across participants is a pair: did this participant put card A and card B in the same group, yes or no?
The method follows from that:
- For every participant, list every pair of cards that share a group.
- For every pair of cards in the study, count how many participants grouped them together.
- Divide by the number of participants to get a percentage.
Group names are ignored at this stage. One participant's "Delivery" and another's "Shipping" are different labels, but the cards inside them overlap. Reading the names is a separate, qualitative step.
Counting pairs in Python
This script counts pairs for a small study of three participants and four cards.
from itertools import combinations
from collections import Counter
# Each participant's open sort: group name -> cards placed in that group
sorts = [
{"Delivery": ["Shipping rates", "Track order"], "Help": ["Returns"], "Other": ["Gift cards"]},
{"Orders": ["Track order", "Returns", "Shipping rates"], "Extras": ["Gift cards"]},
{"Shipping": ["Shipping rates", "Track order"], "Returns and gifts": ["Returns", "Gift cards"]},
]
pair_counts = Counter()
for sort in sorts:
for group in sort.values():
for a, b in combinations(sorted(group), 2):
pair_counts[(a, b)] += 1
n = len(sorts)
for (a, b), count in sorted(pair_counts.items(), key=lambda item: -item[1]):
print(f"{a} + {b}: grouped by {count} of {n} participants ({count / n:.0%})")It prints:
Shipping rates + Track order: grouped by 3 of 3 participants (100%)
Returns + Shipping rates: grouped by 1 of 3 participants (33%)
Returns + Track order: grouped by 1 of 3 participants (33%)
Gift cards + Returns: grouped by 1 of 3 participants (33%)Two details matter here:
sorted(group)puts each pair in a fixed order. Without it,("Returns", "Track order")and("Track order", "Returns")would be counted as different pairs.- Pairs that nobody grouped never appear in the counter. That is fine for a list but wrong for a matrix, where those pairs must show as 0%. The next script handles them.
Building the full matrix
A similarity matrix has one row and one column per card. Each cell holds the share of participants who grouped that row's card with that column's card. The matrix is symmetric, because A with B is the same fact as B with A. The diagonal is 100%, because every participant "groups" a card with itself.
from itertools import combinations
import numpy as np
cards = ["Shipping rates", "Track order", "Returns", "Gift cards"]
index = {card: i for i, card in enumerate(cards)}
sorts = [
{"Delivery": ["Shipping rates", "Track order"], "Help": ["Returns"], "Other": ["Gift cards"]},
{"Orders": ["Track order", "Returns", "Shipping rates"], "Extras": ["Gift cards"]},
{"Shipping": ["Shipping rates", "Track order"], "Returns and gifts": ["Returns", "Gift cards"]},
]
counts = np.zeros((len(cards), len(cards)), dtype=int)
for sort in sorts:
for group in sort.values():
for a, b in combinations(group, 2):
i, j = index[a], index[b]
counts[i, j] += 1
counts[j, i] += 1
np.fill_diagonal(counts, len(sorts))
similarity = counts / len(sorts)
print(" " * 16 + "".join(f"{c[:6]:>8}" for c in cards))
for card, row in zip(cards, similarity):
print(f"{card:<16}" + "".join(f"{v:>8.0%}" for v in row))The result:
| Card | Shipping rates | Track order | Returns | Gift cards |
|---|---|---|---|---|
| Shipping rates | 100% | 100% | 33% | 0% |
| Track order | 100% | 100% | 33% | 0% |
| Returns | 33% | 33% | 100% | 33% |
| Gift cards | 0% | 0% | 33% | 100% |
The matrix shows one solid pair (Shipping rates and Track order), one card that sits between groups (Returns), and one card that is mostly alone (Gift cards). Everything else in this chapter is about reading this kind of pattern reliably.
Reading the matrix
Look for blocks, meaning sets of cards that all have high values with each other. Reordering rows and columns so similar cards sit next to each other makes blocks visible. Most card sorting tools do this automatically, and a spreadsheet with a colour scale on the cells does it by hand.
Percentages need a sense of scale. These thresholds are rules of thumb, not statistical cut-offs:
| Value | Reading |
|---|---|
| 70% or more | Strong agreement. Treat the pair as a likely group. |
| 40% to 70% | Contested. Check the category names and comments before deciding. |
| 10% to 40% | Weak. Often a bridge card that belongs in more than one place. |
| Under 10% | Participants did not see these as related. |
Sample size limits how fine these readings can be. With 10 participants each cell moves in steps of 10 points. With 30 participants a single person shifts a cell by about 3 points. A difference between 60% and 70% in a small study is one person's decision.
Edge cases that distort the counts
Catch-all groups. Participants put cards they cannot place into "Other", "Misc" or "Not sure". Those cards were not judged to be similar. They were given up on. If you count them as pairs, unrelated cards appear related. Before counting, remove groups with such names, or flag them and compare the matrix with and without them.
Unsorted cards. In some online tools a participant can leave cards ungrouped. Treat these cards as having no pairs for that participant. Then decide on a denominator and keep it fixed. Dividing by all participants is simpler and slightly lowers the values of cards that people skipped. Dividing by only the participants who sorted both cards avoids that but makes the cells less comparable. Whichever you choose, state it in your report.
Very large and very small groups. A participant who makes one group of 20 cards adds 190 pairs. A participant who makes 20 groups of one card adds none. Both are weak signals. Check the distribution of group counts per participant and consider excluding or down-weighting extreme sorts. Do this on stated criteria, such as "fewer than three groups", so you are not removing inconvenient data.
Cards in several groups. Some tools allow a card in more than one group. Count a pair once per participant, even if the two cards appear together in two of that participant's groups. Otherwise one person counts twice.
Duplicate or near-duplicate cards. Two cards that describe almost the same thing, such as "Delivery costs" and "Shipping rates", will show very high similarity for a trivial reason. Check the card list when a pair scores near 100% and the cards look redundant.
What happens next
The matrix is the input to two later steps. Hierarchical clustering uses distance, which is 1 minus similarity, to propose groups automatically. The qualitative review of category names then tells you what to call those groups and where the clusters are wrong. Neither replaces looking at the matrix first. A clustering algorithm always returns clusters, even from noise, so you need to know from the matrix whether strong blocks exist before you trust the output.
Exercise
Three of eight participants put "Invoices" and "Payment methods" in the same group. A fourth participant put them in a group named "Not sure". Using the counting rule from this chapter, what is the similarity for this pair if you exclude catch-all groups, and what is it if you include them?
Show answer
Excluding the catch-all group, 3 of 8 participants grouped the pair, so similarity is 3/8 = 37.5%. Including it, 4 of 8 grouped them, so similarity is 50%. The catch-all group raises the value without showing that the participant saw the cards as related, so exclude it, or at least report both figures.
Exercise
In the second script, why does the code add to both counts[i, j] and counts[j, i], and why is np.fill_diagonal needed?
Show answer
The matrix must be symmetric, because "A grouped with B" is the same fact as "B grouped with A", so each pair updates both cells. The loop only visits pairs of different cards, so it never touches the diagonal. np.fill_diagonal sets each card's similarity with itself to the participant count, which gives 100% after division.