## 2 Materials and Methods
### Data Analysis  
In the following, we represent a single Raman spectrum as a vector \(x\) of dimension \(N_{p}\). In the supervised learning framework, a discrete variable \(y\), called the label, is associated with \(x\). As stated before, we have a set \(\{(x_{i},y_{i})\}\), with \(i=1,\dots,N_{s}\), representing all the available instances. The instances \(\{x_{i}\}\) can be conveniently conceived as the rows of a matrix \(X\) of size \(N_{s}\times N_{p}\). As stated in the Introduction section, the main objective of this work was to employ RS in combination with ML to classify bone tissue. In particular, we focused our attention on three distinct classification problems:  
1. The problem of distinguishing between EC and CS (EC-CS). In this case, \(y\) can assume the values EC and CS;
2. The problem of distinguishing between G1, G2, and G3 (G1-G2-G3). In this case, \(y\) can assume the values G1, G2, and G3;
3. The problem of distinguishing between EC, G1, G2, and G3 (EC-G1-G2-G3). In this case, \(y\) can assume the values EC, G1, G2, and G3. To this aim, we employed three ML protocols:  
* Support vector machine (SVM): This ML tool was originally conceived to find the hyperplane that correctly separates clouds in a space of dimension \(N_{p}\) corresponding to different values of \(y\). Let \(w\cdot x+b=0\) be the equation of the hyperplane, where \(w\) is an \(N_{p}\)-dimensional vector normal to the hyperplane, \(b\) a real number, and \(\cdot\) denotes the scalar product. In the version of SVM implemented in this work, the parameters related to \(w\) and \(b\) were optimized by solving the following bound minimum problem: \[ \begin{cases}\min_{w,b,e_{i}}||w||^{2}+C\sum_{i=1}^{N_{s}}e_{i}\\ y_{i}(w\cdot x_{i}+b)\geq 1-e_{i},\\ e_{i}\geq 0\end{cases} \quad i=1,\dots,N_{s}\] (1) In this equation, \(||w||\) denotes the Euclidean norm of \(w\). In addition, \(C\), here fixed to 0.4, represents a regularization parameter accounting for the penalty related to the presence of outliers, i.e., instances. Finally, the parameters \(\{e_{i}\}\), here fixed to 0.8, are variables aimed at relaxing the constraints [26]. Despite there being more  
Figure 2: (**a**) Image of a stained histological section of tissue corresponding to G1; (**b**) image of a stained histological section of tissue corresponding to G2; (**c**) image of a stained histological section of tissue corresponding to G3; (**d**) image of a stained histological section of a tissue corresponding to EC. The images of the histological sections were obtained with a magnification of 20\(\times\). advanced versions of SVM, conceived to separate the classes of interest through hypercurves more complex than a hyperplane, with the aim of comparing the general behavior of classifiers of variable complexities, we adopted the classical linear kernel as representative of a linear model to compare it with non-linear ML classifiers. * Random forest classifier (RFC): RFC is a \"bagging\" ML routine, building the classifier as an ensemble, or forest, of decision trees. A single tree is built from an ensemble of Raman spectra obtained through a procedure called bootstrap sampling. This selection procedure is aimed at selecting \(N_{s}\) spectra, with the possibility of repeated spectra within the resulting dataset. Then, \(k\) spectral components, with \(1<k\leq N_{p}\), are randomly selected to build each node of a single tree. Among the previously selected spectral components, the best one is selected according to its capability to discriminate the values of the label \(y\). In this paper, we adopted [PERSON]'s index as the parameter quantifying this ability. The growth of each tree was stopped when a perfect separation of the spectra belonging to the training dataset was obtained. The final RFC classifier contained 4000 trees, considered a good solution to obtain small levels of overfitting and small out-of-bag error [27]. The response of the entire classifier is thus given by the majority of the predictions of its trees.