## 2 Materials and Methods
### Feature Representation  
The CD source data were structured using nominal variables represented as numerical vectors. To achieve this, one-hot encoding was applied, assigning unique binary values to each category of the original variable. For example, the HIV status variable has three possible values: positive, negative, and unknown. Consequently, three separate columns were created, each representing one of these values. A binary value of one (1) was assigned when the condition was present, and zero (0) otherwise. This numerical representation enables ML algorithms to be trained using categorical variables from the CD without implying any specific order or preference among them. For NLP applications, computers process language in the form of text extracted from patients' documents. However, these texts need to be converted into numerical representations for ML algorithms to analyze and learn from the data. To achieve this, two different text representation methods were explored, where each document is transformed into a vector that captures its content. **Term Frequency-Inverse Document Frequency:** The first method employs term frequency-inverse document frequency (TF-IDF) [39]. This metric helps emphasize words that frequently appear in a document while penalizing those that occur across multiple documents. The informativeness of a word is inversely related to the number of documents in which it appears, as words that are common across documents contribute less to classification. Equation (1) shows how \(IDF(t)\) was calculated for each term \((t)\), where \(n\) is the number of documents, and \(DF(t)\) is the number of documents in the document set that contain the term \((t)\). The set of all the terms that appear in the documents is known as the vocabulary. \[IDF(t)=log\bigg{(}\frac{1+n}{1+DF(t)}\bigg{)}+1, \tag{1}\]  
After calculating the \(IDF\) for all terms, the TF-IDF is obtained by multiplying the term frequency (TF) of each item in a document by its corresponding \(IDF\) value. As a result, each document is represented by a vector containing the TF-IDF values for all terms in the dataset. Additionally, L2 normalization was applied to each vector to ensure that the sum of the squares of its elements equals 1. Moreover, TF-IDF terms are not limited to single words; n-grams can also be used. N-grams are contiguous sequences of elements--for example, a 2-g consists of two consecutive words in a document. This approach captures language structure and enhances contextual understanding. Several n-gram combinations were explored to construct the vocabulary. Different combinations of _n-grams_ were explored to build the vocabulary: (i) 1-g (a single term), (ii) 1-g and 2-g combination, (iii) 2-g, (iv) 1-g, 2-g, and 3-g combination, (v) 3-g. Since the vocabulary can become extensive, the vector size was constrained within a specified \(DF(t)\) range, with the minimum and maximum values optimized during the process. Additionally, the vocabulary was capped at 1000 terms. However, given the high dimensionality relative to the available samples, dimensionality reduction was applied using truncated singular value decomposition (SVD), with the number of components also optimized. Version 1.0 of the _Scikit Learn_ library was used to compute the TF-IDF vector for each document [40]. The vectorization process followed the parameters described earlier, including word-based analysis, _n-grams_ ranging unigrams to trigrams, and a maximum of 1000 features. As mentioned in the previous subsection, stop words were excluded during preprocessing based on the Spanish language. **Embeddings Representation:** The second method employed embeddings representations. In this approach, each term is represented by a vector, where words with similar meanings or those used in similar contexts have closely related vector representations. There are different ways to generate embeddings: they can be learned from an ML model during training on a specific task or obtained in an unsupervised manner from document statistics [41].