## 4 Transforming Full Guidelines Documents into Vectors and Graphs
### Measuring Distances between Full Documents  
When creating embedding representation of text, we replace each word or term with its embedding representation. Thus, the text full guideline documents are represented as a set of vectors. Our objective is to create a graph of conceptual distances between the documents.  
The two most commonly used measures of distance, _cosine distance_ and _word mover's distance_, operate on different representations. The former operates on pairs of vectors, and the latter on sets of vectors. Thus, we need to create two types of representations.  
Given a document, the first representation takes the average of all its word (term) embeddings. This creates a vector representing the guideline text. The second representation simply keeps the set of all its embedding vectors.  
The _cosine distance_ between two vectors \(v\) and \(w\) is defined as:  
\[cosd(v,w)=1-cos(v,w)\]  
We will also use the following variant of cosine distance to argue that the geometries we obtain in our experiments are similar irrespective of distances measures (see Section 6):  
\[cosd^{\prime}(v,w)=1/cos(v,w)-1\]  
The _word mover's distance_ (WMD, WM distance), introduced in [48], is a variant of the classic concept of \"earth mover distance\" from the transportation theory [49]. Sometimes, the term \"Wasserstein distance\" is also used. The intuition encoded in this metric is as follows. Given two documents represented by their set of vectors, each vector is viewed as a divisible object. We are allowed to \"move\" fractions of each vector in the first set to the other set. The WM distance is the minimal total distance accomplishing the transfer of all vector masses to the other set. More formally [48], WM distance minimizes:  
\begin{table}
\begin{tabular}{l l l l} \hline \hline
**Guideline** & **Full Name of the** & **URL Reference** & **Document Citation** \\ \hline
**ACS** & American Cancer & [[https://www.ncbi.nlm.nih.gov/](https://www.ncbi.nlm.nih.gov/)]([https://www.ncbi.nlm.nih.gov/](https://www.ncbi.nlm.nih.gov/)) & [45] \\  & Soeity & pmc/articles/PMC4831582/ & [46] \\ \hline
**IARC** & International Agency & [[https://www.nejm.org/doi/full/10.1](https://www.nejm.org/doi/full/10.1)]([https://www.nejm.org/doi/full/10.1](https://www.nejm.org/doi/full/10.1)) & \\  & for Research on Cancer & 056/NEJMc1508733 & [46] \\ \hline  & United States & [[https://annals.org/aim/fullarticle/](https://annals.org/aim/fullarticle/)]([https://annals.org/aim/fullarticle/](https://annals.org/aim/fullarticle/)) & \\
**USPSTF** & Preventive services & 2480757/screening-breast-cancer-u-s- & [47] \\  & Task Force & preventive-services-task-force- & \\  & & recommendation & \\ \hline \hline \end{tabular}
\end{table}
Table 4: _Cont._\[\min_{\mathbf{T}\geq 0}\;\sum_{i,j=1}^{n}\mathbf{T}_{ij}c(i,j)\] subject to: \[\sum_{j=1}^{n}\mathbf{T}_{ij}\;=d_{i}\;\;\;\forall i\in\{1,\dots,n\}\] \[\sum_{i=1}^{n}\mathbf{T}_{ij}\;=d^{\prime}_{j}\;\;\;\forall j\in \{1,\dots,n\}.\]  
where \(T_{ij}\) is the fraction of word \(i\) in document \(d\) traveling to word \(j\) in document \(d^{\prime}\); \(c(i,j)\) denotes the cost \"traveling\" from word \(i\) in document \(d\) to word \(j\) in document \(d^{\prime}\); here the cost is the Euclidean distance between two words in the embedding space. Finally, \(d_{i}\) is the normalized frequency of word \(i\) in document \(d\) (and same for \(d^{\prime}\)):  
\[d_{i}=\frac{c_{i}}{\sum_{j=1}^{n}c_{j}}\]  
We used the n_similarity and wmdistance functions from Gensim [50] as a tool for generating vectors and calculating similarities/distances in our experiments.