## 2 Materials and Methods
### Classification  
Classification trees are supervised learning models that work well, both with categorical (classification trees) and quantitative (regression trees) data. The methodology behind classification trees is to recursively split data, based upon the predictors that best distinguish the response variable classes [14; 26]. They are computationally efficient and can easily handle continuous and discrete (or mixed) or missing data. They are highly flexible, and naturally uncover complex and nonlinear interactions among the independent variables. Classification trees are also popular because they can easily be combined into learning ensembles. To classify the LMNB1 morphology, we tested several types of classification trees and tree ensembles, in association with different types of cross-validatWeion (CV), in order to assess their performance. Cross-validation (CV) is a method used to evaluate ML models, but it is also strictly intertwined with training; therefore, the choice of CV can influence the accuracy of the model. The simplest cross-validation method consists of splitting the dataset into a training and a test set. This is clearly not a viable method when dealing with small datasets, because it subtracts data for training. Here, we test more sophisticated CV methods such as k-fold CV, bootstrap, leave-one-out CV and stratified CV, in order to optimize the prediction on our sample. We trained three classifiers, a simple tree, an ensemble of bagged trees (TreeBagger) and, finally, an ensemble of boosted classification trees (Tree ensemble), to classify astrocytes into one of five classes: homogeneous, dotted, wrinkled, forming crumples, or forming micronuclei. Alternatively, we also trained the classifiers to classify astrocytes into one of three classes, by merging Classes 1 and 2 together, and 3 and 4 together. The classifiers' implementation was performed in MATLAB.  
To handle class imbalance, we used RUSBoost [16] for the tree ensemble. RUSBoost is an ensemble method that combines the strengths of both random undersampling and the popular boosting algorithm, AdaBoost. By randomly undersampling the majority class and then applying AdaBoost, RUSBoost can balance the class distribution, while also maintaining the strong performance of the boosting algorithm. Additionally, RUSBoost also uses a cost-sensitive approach to weigh the misclassification error of the minority class higher, further addressing the imbalance in the data. Overall, RUSBoost is a powerful technique for handling unbalanced datasets, and has been shown to achieve strong performances in various classification tasks. For the classification tree, we used a cost error matrix. The cost for each class was assigned as the inverse of the frequency. To train the classifiers, we used a set of eight variables: GFAP expression, cell morphology, number or ramifications, cellular area, soma area, nuclear area, normalized intensity of LMNB1, normalized intensity of GFAP, and normalized intensity of AQP4. Since the following variables (normalized intensity of LMNB1, normalized intensity of GFAP, normalized intensity of AQP4, see Table S3) were acquired in different sessions, and their measurement is dependent on acquisition settings, we normalized their values using the z score. Finally, we compared several types of cross-validation: five-fold cross validation, LOOCV, stratified cross-validation and bootstrapping. For bootstrapping, first, we split the sample into training (80%) and testing (20%) datasets, and then resampled both sets with 2500 permutations. Since we were dealing with multiclass classification, the accuracy, sensibility, sensitivity and F1 score were computed for each class, and then averaged weighting for the size of each class was obtained. All analyses were made with Matlab R2022a, The MathWorks, Natick, 2022.