## 2 Materials and Methods
### Data Analysis  
For each measurement, impedance data were split into 8 groups according to 8 frequency sub-ranges within a 1-100 kHz range (so that each subgroup had the same number of frequencies for which the measurement was performed):  
* 1-7 kHz;
* 7.5-19 kHz;
* 20-32 kHz;
* 33-45 kHz;
* 46-58 kHz;
* 59-71 kHz;
* 72-84 kHz; and
* 85-100 kHz. In each group, average, median, and standard deviation of impedance moduli and phase shift, were calculated. Coefficients for 7 th-order polynomial and two-term exponential fitting of the whole curves were also estimated. All those features were considered as input parameters for machine learning models. They were separately calculated for each position and for each patient. That approach initially gave 160 results (20 patients times 8 positions of the probe). Figure 3: Presentation of measurement degrees relative to woman’s body position. Figure 2: Presentation of the ONIRY study. The subject lies on her side and the probe is placed in the anal canal. Probably, muscle contraction can be treated as a possible noise source in the impedance measurement; however, participants were asked not to perform any active contraction during impedance measurement. Therefore, we did not assess its possible impact. We decided to evaluate the performance of machine learning binary models using an ultrasound-based OASI classification (\(\leq\)2 vs. \(>\)2, which corresponds to no injury of the anal sphincter muscles vs. the presence of injury of the sphincter muscles) and clinically-based Wexner scale (=0 vs. \(>\)0, which corresponds to no problem with any type of incontinence vs. the presence of a problem with stool or gas incontinence). However, as only a small number of participants was ultimately diagnosed with a sphincter injury (grade more than 2 in OASI classification) and as for those women sphincter damage occurred only in the anterior part of the anal canal, \"injured\" label outputs were marked only on measurements for angles \(-\)45, 0, and 45 degrees that corresponded to the part of the sphincter periphery from the side of the birth canal (where the injuries occurred), as shown in Figure 3. The rest were labeled as \"non-injured\". That approach gave 9 results labeled as injured and 151 labeled as non-injured for OASI classification. For the Wexner scale, it was 24 and 136 respectively for injured and non-injure labels. Therefore, as a parallel \"descriptive\" branch of the analysis process, we decided to re-analyze the input data (impedance parameters). This would enable us to evaluate the results for the more balanced case. There are several approaches to deal with imbalanced data. As the sample size from the first pilot clinical trial is small, an order of magnitude is consistent with other pilot studies, so we did not take into account up- and down-sampling and chose a more sophisticated approach. The Synthetic Minority Oversampling Technique (SMOTE) method was used for this purpose [53]. Along with original data, which remain in the process, it provides statistically similar results from a smaller subgroup (based on the difference between samples in the group; first, the difference between each feature vector in the group and its nearest neighbor or neighbors is calculated; then, this difference is multiplied by a random number between 0 and 1; and the obtained product is added to the current feature vector, thus obtaining new feature vectors), and neglects some results from the larger subgroup in number depending on the group distribution. Finally, we obtained 175 results for labels of the OASI classification with 36 injured and 139 non-injured results, respectively, and 202 results for the Wexner scale with the distribution of 94 injured and 108 non-injured, respectively. Thanks to this approach we arrived at 21% injured results for the OASI classification and 47% for the Wexner scale.