Sets, shapes and definitions

A∪B,A∩BA \cup B, \quad A \cap B Union and intersection

Union ∪: in either set. Intersection ∩: in both.

In ML papers

A∪BA \cup B (the union, a cup) holds everything that is in AA, in BB, or in both. A∩BA \cap B (the intersection, a cap) holds only what is in both. The large forms work like a sum sign: ⋃i=1nAi\bigcup_{i=1}^{n} A_i joins nn sets.

In ML papers they show up in dataset splits (train and test should have Dtrain∩Dtest=∅\mathcal{D}_{\text{train}} \cap \mathcal{D}_{\text{test}} = \emptyset), in metrics such as intersection over union, ∣A∩B∣∣A∪B∣\frac{|A \cap B|}{|A \cup B|}, for boxes and masks, and in probability, where P(A∩B)P(A \cap B) is "AA and BB" and P(A∪B)P(A \cup B) is "AA or BB".

How to type it

LaTeXShows
\cup∪\cup
\cap∩\cap
\bigcup_{i=1}^{n} A_i large, with limits⋃i=1nAi\bigcup_{i=1}^{n} A_i
\bigcap_{i=1}^{n} A_i⋂i=1nAi\bigcap_{i=1}^{n} A_i

A worked example

{1,2,3}∪{3,4}={1,2,3,4},{1,2,3}∩{3,4}={3}\{1, 2, 3\} \cup \{3, 4\} = \{1, 2, 3, 4\}, \quad \{1, 2, 3\} \cap \{3, 4\} = \{3\}

Intersection over union here is 1/41/4.

Common confusions

Related

D={(xi,yi)}i=1N\mathcal{D} = \{(\mathbf{x}_i, y_i)\}_{i=1}^{N}Set bracesa∧b,a∨b,¬aa \land b, \quad a \lor b, \quad \neg aLogical and, or, notA∩B=∅A \cap B = \emptysetEmpty setB⊆D\mathcal{B} \subseteq \mathcal{D}Subset

Decode this example →