# How to represent a set of sets as a vector

I'm pretty new to machine learning.

I know I can represent a set of discrete values as a vector of 0/1 values. For instance, in the set of features {a, b, c, d, e}, the subset containing {a, c} can be represented as [1, 0, 1, 0, 0] and the subset containing {c, d, e} can be represented as [0, 0, 1, 1, 1], meaning I have as many dimensions as elements, which is workable when you have a finite (and small) number of elements.

But now, for a clustering task, I want to represent sets of sets, like, for instance, representing the set {{a, c}, {c, d, e}}. How can I do that? Here, the basic 0/1 approach won't work, as I'll have 2^n possible combinations. What is the workaround, if any?

Edit: here is the transcription as a less abstract, more business problem. I want to find clusters of people according to the trips they made. A trip consists in a set of cities visited, and a set of transportation used. For instance, people might have visited cities in the set {Rabat, Alger, Marrakech, Tunis, Hammamet} with transportation such as {car, plane, train}. A trip could be {Rabat, Marrakech, plane} or {Alger, Marrakech, Tunis, car, train}. Note the order in which cities were visited, or the order in which vehicles were used, is not considered.

An example of the items I want to find clusters of could be a person having made those two trips, represented as p1 = {{Rabat, Marrakech, plane}, {Alger, Marrakech, Tunis, car, train}}.

• To be sure I understand, for one observation you have a set of subsets as the observed data point? Commented Mar 29, 2018 at 14:05
• yes @kbrose, {{a, c}, {c, d, e}} is one of the datapoints I want to clusterize. Commented Mar 29, 2018 at 14:41
• You may benefit from a reformulation. What's the real, business problem?
– Emre
Commented Mar 29, 2018 at 16:07
• Thanks for the suggestion @Emre, I just made a detailed example. Commented Mar 30, 2018 at 8:36
• And what would you do next? There is little benefit in just encoding the data, you need to be able to do meaningful computations, too. Commented Apr 8, 2018 at 19:09