A multiset consists of a set and a function , where is a universal set and if and only if .
We can add two multisets and to get
Note that we can write
for .
We can also define an inner product of multisets via
Note that when and are simply sets, and are the characteristic functions and
where denotes the cardinality of the set.
Using this inner product, we can define the angle between multisets as
In particular, when we have
and when we have
When and are simply sets, the angle between them is given by
With this notion of addition, the collection of multisets in becomes the -module (that is abelian monoid) ; this inner product makes it an inner product space analogous to the Banach space .
Machine Learning
The inner product of multisets is closely related to the βbag of wordsβ kernel in machine learning (see n-Cafe).