For two vectors \( \boldsymbol{a} \) and \( \boldsymbol{b} \) Cosine similarity is based on their inner product and defined as
The resulting similarity value ranges from −1 meaning exactly opposite, to 1 meaning exactly the same, with 0 indicating orthogonality. Since we use \( \mbox{tf} \ast \mbox{idf} \) weights, which cannot be negative, the cosine similarity between two word bags representing the input time series sets will range from 0 to 1.