{'fraction_non_alphanumeric': 0.031251365881375934, 'fraction_numerical': 0.017614406224048255, 'mean_word_length': 4.730619912335629, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Exploring key ionic interactions for magnesium degradation in simulated body fluid – A data-driven approach

We have studied the degradation of pure magnesium wire in simulated body fluid and its subsets under physi- ological conditions to enable the prediction of the degradation rate based on the medium ’ s ionic composition. To this end, micro-computed tomography and scanning electron microscopy with energy-dispersive X-ray spec- troscopy were used, followed by a tree regression analysis. A non-linear relationship was found between degradation rate and the precipitation of calcium salts. The mean absolute error for predicting the degradation rate was 1.35 mm/yr. This comparatively high value indicates that ionic interactions were exceedingly complex or that an unknown parameter determining the degradation may exist.


Introduction
Magnesium (Mg) is studied increasingly for its potential as a temporary non-load-bearing bone implant due to its biodegradability, suitable mechanical properties and non-toxicity [1,2]. In order to understand the degradation of Mg in the body's chemical environment, in vitro tests are conducted in media mimicking the physiological environment [3]. Different immersion media are used; some of them containing only ionic components, such as simulated body fluid (SBF) or Hank's balanced salt solutions (HBSS), while others also include glucose and can be enriched with proteins, which is the case for most cell culture media, such as Dulbecco's modified Eagle's medium. Additionally, the temperature is set to 37 • C, the environmental CO 2 level is set to 5% and oxygen content can further be regulated [3]. SBF in particular is used due to its simplicity and ease of preparationhowever, different formulations exist as the initial formulation by Kokubo [4] was updated to account for the binding of multiple components to proteins [5] with further simplification and refinements in terms of pH equilibration [6]. The exact formulation influences the saturation indices and hence precipitation of different salts [6,7]. The formation of hydroxyapatite (Ca 5 (PO 4 ) 3 OH) in particular is desired, which in its carbonated form is the mineral phase of bone [8,9].
Previous experiments have aimed at determining the influence of different experimental conditions [10][11][12][13] and ionic components [14][15][16][17] on the degradation of Mg and the formation of a protective degradation layer. Mei et al. showed in particular that it was the combination of HCO − 3 , HPO 2− 4 and Ca 2+ ions that resulted in a protective layer that was not present when any of the salts containing these ions were removed [15]. It needs to be stated, however, that while being strongly informative, the immersion tests in the study by Mei et al. were conducted at room temperature and without CO 2 buffering, therefore being less comparable to physiological conditions. The influence of the environmental CO 2 content on the degradation in particular was shown to have a significant effect on Mg degradation [11], and therefore must be taken into account. pH has also been shown to significantly influence Mg degradation [13,18] and should therefore be adjusted when comparing different media [16]. Lamaka et al. [14] showed that during the degradation pH varies significantly between bulk solution and the solution in the vicinity of the magnesium surface. Therefore, bulk pH measurements must be interpreted carefully when attempting to understand the ionic interaction.
Lamaka et al. [14] further found that the addition of Ca 2+ ions to HBSS led to a strong decrease of near-surface pH during degradation of Mg alloys and a decrease in degradation rate of around 60%. The concentration of HCO − 3 , which varies for different SBF formulations, has a strong influence on Mg degradation, with larger degradation inhibiting effects measured for a concentration of 27 mM and higher (when in SBF) [17]. Carbonate ions otherwise promote Mg degradation at early time points [16,19,20], but lead to the formation of a protective carbonate layer over time, while phosphate ions directly induce the formation of a protective phosphate layer [16,19,20] which is particularly stable in a pH range between 4-7 [21]. Increasing chloride ion concentrations have been shown to promote Mg degradation, due to the dissolution of the protective Mg(OH) 2 film, and more so for lower pH ranges, as the film is unstable below a pH of 10.5 [22,23]. Further studies on the influence of ionic components on Mg degradation using HBSS including also organic components by the addition of foetal bovine serum showed similar degradation promoting effects of larger concentrations of HCO − 3 and corrosion inhibition through the addition of CaCl 2 , which was associated with the deposition of a calcium-and phosphate-rich layer [24]. In addition to the importance of ionic content, it has been shown that the volume to area ratio (VA) of immersion medium and Mg sample can have a significant influence on the degradation process, which is likely due to a depletion of ions in cases with limited volume. For a VA of 5 and higher, no significant differences in the degradation rate have been observed [25,26].
Whilst the degradation rate of Mg is traditionally determined by measuring H 2 evolution or weight loss [27], high-resolution synchrotron-radiation micro-computed tomography (SRμCT) has been shown to be a powerful tool for the non-destructive evaluation of Mg degradation in situ [28,29]. Similarly, laboratory μCT machines may be used to analyse sample degradation at distinct time points [16,30]. This allows for a subsequent analysis of the structural or elemental composition of the degradation layer using e.g. X-ray diffraction or scanning electron microscopy (SEM) with energy-dispersive X-ray spectroscopy (EDX) [27,28].
Following experimental measurements, methods from machine learning can be applied to determine the influence of experimental conditions on Mg degradation. Willumeit et al. [11] applied artificial neural networks (ANNs) to highlight the importance of the atmospheric CO 2 content on the degradation and were able to predict the degradation rate of Mg subject to different conditions with a 90% confidence of 0.55 mm/yr. The combination of experimental techniques, density functional theory calculations and data science has further led to the identification of molecular structures of organic corrosion inhibitors [31,32], thus displaying once more the potential of machine learning techniques for materials science applications.
In this work, we have investigated the degradation of pure Mg wire in SBF and pH-adjusted subsets thereof under physiological conditions (37 • C, 5% CO 2 ) using laboratory μCT and SEM+ EDX and a subsequent analysis using randomised decision trees in order to: (i) Understand the interaction of the individual ionic components of SBF and their influence on Mg degradation under physiological conditions. (ii) Understand the interplay of the ionic components and Mg degradation for the formation of hydroxyapatite within the degradation layer. (iii) Evaluate the accuracy of thermodynamic predictions of precipitate formation by comparing them to experimental results. (iv) Predict Mg degradation based on experimental conditions and ionic media composition. We will present the degradation rate analysis based on μCT measurements and discuss the influence of different salts and pH adjustments thereon. Based on EDX measurements, we will discuss the precipitation of different degradation products and highlight the importance of calcium precipitates, in particular hydroxyapatite, and the influence of preprecipitation of salts in the immersion media. Finally, we will assess the correlation (both linear and non-linear) between the degradation rates and experimental parameters and showcase how well machine learning methods are able to predict the degradation rate based on the experimental parameters.

Sample preparation
Pure magnesium (Mg) was melted and the ingot was cast using the permanent direct chill casting process [33]. The holding time during the casting process was 5 min prior to a controlled immersion in a water reservoir. The ingot was prepared for direct extrusion into cylinders with a diameter of 49 mm and a length of 150 mm. This extrusion was carried out at 350 • C after the block was preheated for one hour. The extrusion was then conducted at a speed of 0.15 mm/s using a die with four holes of ∅ 1.0 mm each (extrusion ratio 1:625). Each wire was spooled separately onto a spool during extrusion. The chemical impurities of pure bulk Mg were determined by spark spectrometry to a content of 20 ± 4 ppm Fe, 14 ± 1 ppm Cu and 12 ± 3 ppm Ni.
Using a custom Mg punch, samples of a length of approximately 5 mm were cut by punching from the wire. The samples were cleaned and sterilised in a series of n-hexane, acetone and 100% and 70% ethanol in an ultrasonic bath.

Wire microstructure analysis
For the microstructure investigations, paces of the wire were embedded in two-component methylmethacrylat (Demotec 30, Demotec Demel e.K, Nidderau, Germany). The microstructure was investigated in longitudinal and transverse directions to the extrusion direction. For the longitudinal direction the samples were ground approximately to the centre of the diameter. Finally, the samples were polished with a watercontaining oxide polishing suspension, a SiO 2 solution, (Schmitz-Metallographie GmbH, Germany) at a speed of 80 min − 1 . The observation of the microstructure was performed using an optical microscope (PMG3, Olympus Corporation, Tokyo, Japan) and the samples were etched by picric acid solution [34].

Media preparation and immersion tests
In order to assess the degradation of pure Mg under physiological conditions, all immersion tests were carried out in an incubator at 37 • C and 5% CO 2 . SBF was prepared in the formulation SBF-JL2 according to [6], see Table 1, as previous results suggested that additional ions K and SO 4 often present in SBF have little influence on the degradation of Mg. Subsets of the solution were prepared from singular salt components to combination of salts, resulting in 16 solutions overall, see Table 2. All media were prepared using double distilled water. Firstly, the singular salt components, i.e., NaCl, NaHCO 3 , Na 2 HPO 4 , CaCl 2 and H 2 O, were prepared at the equilibrium pH under physiological conditions for immersion testing. These are referred to as 1a-5a in Table 2. Secondly, in order to remove the influence of pH on the degradation process, the singular components and all possible combinations were prepared and the pH was adjusted to the equilibrium pH of SBF (7.66 ± 0.18) by adding NaOH or HCl. The pH adjustment was conducted recursively Table 1 Overall concentration of salts in simulated body fluid SBF-JL2 as in [6]. SBF and subsets were prepared according to this formulation. over the course of 32 days to account for the pH regulation via the atmospheric CO 2 buffer. Specifically, all media were prepared according to their concentrations and composition as stated in Tables 1 and 2, and then placed into the incubator for the CO 2 buffer to take effect. After two to five days, which were distributed closer at the beginning of the adjustment, the pH value of the solution was measured and the amount of NaOH or HCl required to reach the desired pH was calculated and added to the medium. The medium was then placed in the incubator again for the pH adjustment through CO 2 buffering. This procedure was repeated for 32 days in total. The pH measurements and adjustment times for each adjustment step and each medium are given in Fig. A.11. Table 2 shows the overall amount of NaOH and HCl added to each solution and the final measured bulk solution pH. For immersion testing, three Mg samples were immersed in 3 ml of each solution in separate wells with one additional well without a sample for control. The samples were laid down on the bottom of the well, such that one part of the wire would be in contact with the well and potentially obstructed from degradation. The experiments were carried out in 12-well plates and the height of solution level was approximately 7.8 mm for all samples. The immersion was conducted over the course of 8 days and the solution was changed every 2-3 days. At these points pH measurements of sample pH and control pH were conducted, as well as the pH of the solution that would be added (initial pH), see Fig. A.12. The refreshing of immersion media is required to avoid the risk of saturation of the medium with degradation products and the depletion of ions and is known as semi-static immersion testing. At day 8, samples were rinsed in 70% ethanol and mounted for μCT imaging.

Degradation analysis using micro computed tomography
Samples were imaged using a laboratory μCT (nanotom S, GE Phoenix, Wunstorf, Germany) before and after immersion testing.
Scanning parameters were varied for the scan after immersion in order to yield better contrast at low overall scan times. See Table 3 for imaging settings. Fig. 1 shows a slice of the μCT image stack of one sample immersed in each respective solution after 8 days.
Image analysis was conducted and automated using Fiji/ImageJ [35]. First, image contrast was enhanced by normalisation of the histogram with 0.5% saturated pixels using the Fiji function enhance contrast. Subsequently, the image data was filtered using a 3D median filter with a 3 × 3 ×3 kernel from the 3D ImageJ Suite [36]. Post degradation samples were previously also filtered using a non-local means filter with default values [37,38]. The Segmentation of post degradation samples was then performed using the trainable WEKA segmentation tool [39], with a classifier trained for each sample. Each image stack was segmented into background, residual Mg and degradation layer. Samples prior to degradation were segmented using manual thresholding. The segmentation of each sample was inspected and corrected manually if required. Segmented samples were aligned to the z-axis using the moments of inertia plugin [40]. In addition to the volumetric information, the sample outline was calculated for the initial scans in Fiji.
Based on the obtained segmentation, the degradation of the samples was analysed. For each sample, a region of interest form the sample centre measuring 0.7 mm in height was analysed to avoid artefacts from the top and bottom end of the cut wires. The initial sample volume V i and surface area A i , as well as residual sample volume V r and precipitation volume V p were calculated from the given segmentations, in μm 3 and μm 2 , respectively.
Given these, the degradation rate DR [mm/yr] was computed as: with t = 8 days and k = 0.365 days mm yr − 1 μm − 1 . k is a constant used to convert the unit of DR into [mm/yr]. Similarly, we have defined the precipitation rate as: in order to assess the extent to which a protective surface layer was formed. Please note, that we use the term precipitation only to refer to the precipitation of salts on the sample surface. A discussion of the precipitation of salts within the medium itself is denoted as such. Based on the initial sample overall outline and the immersion volume (3 ml) Table 2 Subsets of SBF with given solution ID and added amounts of NaOH and HCl for pH adjustments. The solution pH given in the last column is the measured pH after pH adjustments and acclimatization in the incubator (37 • C, 5% CO 2 ). Solutions "a" were non-pH-adjusted.  the VA was calculated, which was above 15 ml/cm 2 for all samples.

Elemental analysis
Following μCT imaging, one sample of each solution was further processed for analysis of the elemental composition of the degradation layer. To this end, the samples were embedded in two-component methylmethacrylat (Demotec 30, Demotec Demel e.K, Nidderau, Germany). After polymerization, the samples were ground and polished on a Saphir 320/Rubin 520 machine (Advanced Materialography, Mammelzen, Germany) to expose the sample cross-section. Grinding was performed using a series of sandpaper grits (220, 500, 800, 1200 and 2400). Subsequently, the samples were polished using water-free oxide polishing suspension and 1 μm diamond suspension. Finally, samples were sputtered with thin layers of carbon or gold, respectively. The exposed cross-section was imaged using SEM+EDX on a Vega SB-U III (Tescan GmbH, Dortmund, Germany) with attached EDX unit. EDX maps at a magnification of approximately 200 were obtained. Elements magnesium (Mg), sodium (Na), chloride (Cl), calcium (Ca), carbon (C), oxygen (O) and phosphorus (P) were investigated for their weight percentage in particular, according to the SBF formulation. Fig. 2 shows exemplary maps for samples immersed in SBF (solution 6) and CaCl 2 (solution 4) with corresponding μCT slices for comparison.
Subsequently, the degradation layer was segmented using Avizo® 9.4.0 (FEI SAS, Thermo Scientific™, France) by applying a region growing algorithm and manual corrections. Given the segmented images, the mean and standard deviation of the weight percentage of each element within the degradation layer were computed in Matlab R2018a (The MathWorks Inc., USA). Matlab was further used to compute the spatial distribution of elements within the degradation layer by applying the distance transform to the segmentation of residual Mg and constricting the resulting distance map to the degradation layer.
For comparison, Hydra-Medusa [41] was used to predict the formation of precipitates in each solution according to thermodynamic stability constants and solubility constants in particular. As the software works with constants at 25 • C, but experiments were conducted at 37 • C, the dissolution constants of the main expected products at 37 • C reported by Kieke et al. [7] were altered within the program. The precipitate fractions were then computed based on the ionic concentration following the information in Tables 1 and 2 and an Mg concentration calculated via the degradation rate.

Statistical analysis and prediction
Following image processing and analysis, statistical analysis and plotting was performed using Jupyter Notebooks from the Anaconda 3 package [42]. To assess whether the degradation rate differed statistically significantly between different solutions, a Student t-test was applied using the scipy stats module [43]. Significance was assumed at p < 0.05. Additionally, in order to discern the correlation between the different experimental parameters and degradation and precipitation behaviour in particular, the Pearson correlation coefficient was computed. Samples from solution 10 were excluded for the correlation with precipitated elements due to the missing degradation layer analysis. In addition to the linear relationships as described by the Pearson r-correlation, all relationships were assessed for non-linearity and where appropriate, an exponential function of the form y = a + b exp(c ⋅ x) or a power law in the form of y = a + b ⋅ x c was fitted using the scipy optimize module. The sum of squares error σ = was calculated for all non-linear relationships. Different regression models from sklearn [44] were trialled to assess the predictability of the degradation rate. Most importantly, random forests, extremely randomised trees and decision trees were compared. For evaluation of the algorithms, a 21-fold cross-validation was implemented, dividing the dataset using 20 solutions for training and one for evaluation. As metric for this regression, the mean squared error (MSE) and mean absolute error (MAE) were compared. To assess the stability of the prediction, the overall training was performed 50 times. Different combinations of input values were tested to assess their influence on the prediction quality. These were experimental input parameters (i.e., initial pH, control pH and ion concentration), all input and experimentally measured parameters (i.e., initial pH, control pH, ion concentration, osmolality, sample pH, difference between sample and control pH, precipitation rate, fluid volume to sample area ratio, weight percentage of precipitated elements) and three states in between in particular, see Table B.6. Feature importances were computed to assess the influence of different experimental parameters on the degradation rate and derive mechanisms.

Results and discussion
3.1. Microstructure   Fig. 3 shows the microstructure of the Mg wire. The shape of the grains is independent of the transversal or longitudinal direction with globular grains. There is an increase in grain size from the surface of the wire towards the centre. This is an effect of the extrusion process and a faster cooling of the wire at the surface, resulting in a smaller grain size. However, the investigation indicates a completely recrystallized microstructure after extrusion. Also visible is the cigar shape in the grains, known as twins originating from material deformation. These twins, which are located closer to the surface, are mainly formed by the spooling process, which is also supported by a higher number of twins at the top right and bottom left in the transverse section (Fig. 3, left). In transversal section, there is no twin in the middle, due to the neutral axis during bending in the spooling process. In the longitudinal section, some twins are visible in the middle, which originate from the preparation for microscopy. This pure Mg is sensitive to scratches and can form twins through entire grains. Neither light microsopy nor μCT (Fig. 1) and SEM ( Fig. 2) investigations indicate the presence of intermetallic phases, which could lead to uncontrolled and inhomogeneous corrosion.

Degradation analysis from μCT images
The mean degradation rate for each medium is displayed in Fig. 4. The corresponding precipitation rates are shown in Fig. 5 and are not discussed in detail, as the results were mainly used in the parameter correlation section. Additionally, 3D renderings of the degraded specimen and formed precipitates are displayed in Fig. A.13 in the appendix.
The highest degradation rates (>7 mm/yr) were observed for solution 10 (NaCl, Na 2 HPO 4 and CaCl 2 ), in which all three samples dissolved completely. Similarly, solution 15 (Na 2 HPO 4 and CaCl 2 ) resulted in high degradation rates (≈7 mm/yr), with one sample fully dissolved at day 7. High degradation rates (6-7 mm/yr) were further obtained for solutions 11 (NaCl, and CaCl 2 ), 16 (NaCl, NaHCO 3 and CaCl 2 ) and 2a (NaHCO 3not pH adjusted). By contrast, the lowest degradation rates (<1 mm/yr) were observed for single component solutions, namely, solution 3 and 3a (Na 2 HPO 4 ), solution 5 and 5a (H 2 O) and solution 1 (NaCl). SBF itself, which is solution 6, resulted in a low to moderate DR of 1.09 ± 0.07 mm/yr. The precipitation rates were similar to the degradation rates if these were below 2 mm/yr.
The degradation rate analysis highlights distinctive changes in ion interaction depending on the presence of other ions in the media. Table 4   was present (solution 2 vs. 12), but led to an increase in degradation rate as soon as NaCl (solution 7 vs. 8) or Ca 2+ (solution 13 vs. 14) were also present, except when all three ions were present (solution 6 vs. 16). The fact that HPO 2− 4 was shown to generally decrease the speed of degradation is in line with previous findings [16,[19][20][21]. HCO − 3 , which generally led to an increase in degradation rate (solution 1 vs. 7, solution 3 vs. 12, solution 2 vs. 5), led to a decrease or no change in the presence of Ca 2+ (solution 4 vs. 14, solution 13 vs. 15), except when all ions were present (solution 6 vs. 13). Ca 2+ led to an increase in degradation rate (solution 1 vs. 11, solution 7 vs. 16, solution 9 vs. 10), except at low pH (solution 4a vs. 4), when solely HCO − 3 (solution 2 vs. 14) or when all other ions were present (solution 6 vs. 8). The ratio between degradation rates of Mg in SBF (solution 6) vs. solution 8 (in which CaCl 2 was removed) was ~1:3, which corresponds to the degradation inhibition through the presence of Ca ions as described by Lamaka et al. [14]. Finally, the calculated degradation rates highlight the well-known influence of chloride ions on the speed of degradation, i.e. most solutions to which NaCl was added resulted in higher degradation rates (e.g. solutions 4 vs. 11, solutions 3 vs. 9) with the exception of NaHCO 3 (solution 2) vs. solution 7 and, interestingly, solution 13 vs. SBF. The comparison between solutions 2 and 7 corresponds to other findings [45], where the difference in degradation was associated with the maturity of the formed Mg(OH) 2 layer.
It is noteworthy that the individual removal of either the buffer salt NaHCO 3 or Na 2 HPO 4 (solutions 10 and 16) from SBF resulted in high DRs, while the individual removal of the other components (solutions 8 and 13) increased the DR in lesser amounts to approximately 3 mm/yr. This indicates the importance of the interaction of both buffers simultaneously and is in agreement with previous findings [15]. At the same time, the increased DR of solution 13 (Na 2 HPO 4 , NaHCO 3 and CaCl 2 ) suggests that other factors influence the degradation process more strongly. Similarly to Mei et al. [15] we found that the simultaneous removal of Ca 2+ and HPO 2− 4 , or Ca 2+ and HCO − 3 resulted in a lesser increase in degradation rate than if buffer salts alone are removed. In contrast to these previous findings we did, however, observe that the removal of HPO 2− 4 has a stronger influence than that of HCO − 3 . This may be due to the fact that a HCO − 3 buffer was already present in our system due to atmospheric CO 2 content and that overall ionic concentration of HCO − 3 was low in the SBF formulation used by Mei et al.
A comparison between single-component solutions (1)(2)(3)(4)(5) shows that the pH adjustment led to a significant (p < 0.05) change of degradation behaviour in all solutions, except in solution 5, which was double distilled water with added NaOH for pH adjustment, see Fig. 4 (blue vs. orange). Specifically, the degradation rate was decreased for solutions 1-3, yet increased for solution 4. This coincided with an observed change in degradation layer morphology, i.e. the samples in solution 4 exhibited the formation of a more highly attenuating layer in μCT images, see Fig. 1. In contrast to samples from solution 4a, this layer was broken up and had exposed the Mg sample. Fig. 6 shows the spatial distribution of elemental weight percentages in the degradation layer for a sample from each solution as measured using EDX. The x-axis was normalized in order to ensure a good visualization of the distribution of elements in all samples. The thickness of the corrosion layer can be estimated with higher accuracy based on μCT images (Fig. 1) and the precipitation rate (Fig. 5). Mg, O, and C were present to a high degree in all samples, indicating that the presence of the CO 2 buffer allowed for a formation of both hydroxide-and carbonate-containing precipitates. Elements Na and Cl were nearly constant below 4 wt.% for all sampleswhich, based on the degradation in solution 5a, double distilled water, indicates no precipitation of an  Table 4 Effect of salt addition on the degradation rate of an immersion medium at adjusted pH (≈7.66). The rows indicate the reference medium and the columns the added salts and their effects. → indicates no significant change, ↑ an increase, ↓ a decrease.  Fig. 7. Vertical lines within each precipitation prediction graph indicate the maximum and minimum pH measured for each solution, including initial and sample pH, in order to estimate the relevant pH range for comparison to EDX measurements. The predicted precipitates, in particular in solutions not containing CaCl 2 , mostly agreed well with observed elements. However, in some cases such as solutions 1 and 5 the measured pH was below the threshold for significant formation of precipitates, which was in contrast to the observed degradation layer. This can in part be explained by a local increase in pH near the sample surface, which can differ significantly from bulk pH in certain solutions [14], and may therefore enable the precipitation of salts. The same holds true for solutions 4 and 4a, and the observed distinctive degradation layers containing either Ca or Mg in solution 4 (see also Fig. 2), which suggests a shift to higher pH near the sample.

Elemental analysis
Ca was present in high amounts in particular in the sample of solution 4a, which corresponded to the highly attenuating layer mentioned previously. Similarly, Ca was present in samples from solutions 4, 6, 13 and 14. A distinct distribution of Ca precipitates towards the outside of the degradation layer can be observed, see Fig. 6. By contrast, the formation of Mg precipitates occurs near the bulk Mg-interface. This is likely to be due to the local supersaturation of Mg near the bulk material, while the transport of Ca 2+ ions through the degradation layer may be slower, thus promoting a preferred precipitation near the sample surface.
P precipitates were observed in solutions 3, 3a, 6, 9 and 12. Solutions 3 and 3a were however error prone, as the observed degradation layer was very thin. In solution 6, the distribution of P is similar to that of Ca (see Fig. 2), indicating the formation of hydroxyapatite, which agrees well with the literature [16] and the prediction shown in Fig. 7 [15]. However, apart from a formation of CaCO 3 , the ratio of precipitated elements in Fig. 6 in comparison with Table B.5 suggests that other Ca precipitates have formed on the sample surface in solutions 4, 14 and 4a in particular, where Ca:O > 1:1. The ratios for most other solutions suggest a formation of MgCO 3 , although Mg:O ratios in solutions 1a and 5a further indicate the formation of Mg(OH) 2 , thus highlighting the need for local pH measurements to more clearly evaluate degradation and precipitation processes. Solutions 3, 3a, 9 and 12 show the formation of a Mg-P precipitate, the exact formulation of which cannot be derived from ratios alone, and Mg-C precipitates. Here, Mg:C ≈ 1, which may be due to the formation of MgC 2 O 4 ⋅H 2 O [24]. This compound appeared to further have formed towards the sample surface in a number of other solutions, such as 2, 2a, 11 and 5a.
Hydroxyapatite was also predicted for solutions 13 and 15; however, the observed elemental composition does not support this prediction. In spots within the SEM image that were individually rastered using EDX and showed high Ca content (>30 wt.%), some P content (2-3 wt.%), little Mg (<8 wt.%), as well as O (~40 wt.%) and C (~14 wt.%). Very few similar spots could be found in μCT images in sample 15, but it was unclear whether these did in fact correspond to such points. Solution 11 showed similar highly attenuating clusters.
These findings are similar to those reported by Mei et al., yet they did find hydroxyapatite in the solution that would correspond to solution 10 (or solution 13 with larger concentrations of Cl); a comparison is difficult, but findings from solution 13 suggest that the formation of  13. Right: μCT slice of the same sample. Two small, highly attenuating areas are visible in the sample degradation layer in the μCT image. Similar areas were observed using SEM, and an EDX analysis showed that they contained calcium and oxygen in high amounts, as well as some phosphate, magnesium and carbon. Scale bars in both images are 100 μm.
hydroxyapatite would be difficult and only localisedwhich may correspond to the small hydroxyapatite signal reported by Mei et al. [15]. The deposition of Ca-containing precipitates on the sample surface may however also have been hindered by the supersaturation of the medium with hydroxyapatite and a precipitation thereof in the medium. Such precipitation was observed for solutions 4, 10, 13, 14 and 16. Solution 15 further appeared cloudy, but there was no obvious precipitation at the bottom of the bottle. We must therefore include the fact that the ionic content in the mentioned solutions may have differed from the theoretical concentrations in our considerations. The degree to which this may be the case was derived from further Hydra-Medusa predictions for the media only and from measured initial pH values, i.e., approx. 10% of Ca concentration for solution 4, 95% for solutions 10 and 13-16, see Fig. A.13. This precipitation may further explain the difference in degradation rates between solution 4 and 4a. A precipitation of salts in the medium of solution 6 would also be expected; however, the formulation of SBF has previously been described as metastable [7], the mechanisms of which require further investigation. Moreover, the precipitation prediction for the media did not appear to apply to all solutions, such as number 14, where a significant amount of Ca precipitation was still found in the sample degradation layer.

Parameter correlation
To assess the correlation between degradation rate, precipitation rate, precipitates and experimental parameters, a Pearson correlation was performed. For the following analysis the initial input concentrations of Ca 2+ , HPO 2− 4 and HCO − 3 were adjusted for solutions 4, 4a, 10, 11 and 13-16 according to an assumed equilibrium precipitation as given by Hydra-Medusa, see Fig. A.13. Notably, HPO 2− 4 was depleted completely when previously present in these solutions. The Pearson correlations for input and measured parameters are given as a heat map in Fig. 9. Precipitation rate and precipitated elements are given on both axes to assess their correlation to the degradation rate.
The degradation rate correlated most strongly (r > 0.6) with the sample pH measured at days 2 and 5, which is likely to be due to the known phenomenon that the degradation is fast in the beginning until the formation of a protective film will slow it down. Generally, correlations between degradation rate and all pH measurements were fair to moderate correlations (0.4 < r < 0.6). The fact that an even higher correlation between sample pH and degradation rate could not be found can be attributed to the presence of the carbonate buffer due to the environmental CO 2 content, the overall large medium volume to sample area and the presence of further buffers in solutions where HPO 2− 4 and HCO − 3 were present. P precipitates correlated strongly (r > 0.8) with the input concentrations of HPO 2− 4 , highlighting the formation of stable P-containing layer in the presence of these ions [21]. Furthermore, a strong correlation (r > 0.75) between O and P is observed, which indicates that most of the precipitated oxygen is in the form of phosphate, if HPO 2− 4 is present. Precipitated Ca correlated with initial Ca 2+ concentrations (r = 0.64), indicating the preferred precipitation of Ca salts as also evidenced in Hydra-Medusa diagrams (Fig. 7). The strong correlation seen for Na and Cl is due to their nearly constant and overall low content. Overall, the low to moderate correlations indicate that there is no single key driver for the degradation of pure Mg in physiological conditions. Non-linear relationships were found in particular for the degradation rate and Ca precipitates or pH measurements. These relationships can be described by exponential or power laws, see Fig. 10. The same holds for the relationship between Ca and P precipitates. It should be noted though that for these correlations only those samples were taken into account where the input concentration of Ca salts or P salts was greater than zero. The negative power law describing the relationship between Ca precipitates and degradation rate indicates that the speed of degradation is crucial for the formation of a degradation layer containing the respective precipitate and vice versa. When considering solutions 4a (CaCl 2 ), 6 (SBF), 13 (Na 2 HPO 4 , NaHCO 3 and CaCl 2 ) and 15 (Na 2 HPO 4 and CaCl 2 ) the relationship becomes more evident; slow degradation results in little H 2 development and the surface of the Mg sample changes only slowly. Thus, we may assume that the environment is fairly equilibrated and a fixed surface allows for the nucleation of the predicted Ca-containing precipitates. We may hypothesise that in solution 13 only distinct points reach such equilibrium, which may be influenced partially by the prior formation of Ca precipitates in the medium, and stay stable during degradation; therefore only few nucleation points, which appear clearly in μCT and SEM images in Fig. 8, are visible.
Finally, the fast degrading solution 15 allows for no such precipitation, also due to the fact that measured pH ranges were below the precipitation limit of CaCO 3 , although the high speed of degradation could be expected to have led to a large local increase in pH. The relationship between degradation rate and precipitation of Ca is expected to go both ways, i.e. the overall speed of degradation is in turn influenced by the forming Ca layer, which is very dense in solution 4a, yet breaks up in solutions 4 and 14, where a higher degradation rate is observed. The nature of the Ca-containing layer in solution 6, however, seems somewhat different. Firstly, based on Fig. 6 and Table B.5 it appears that this is the only sample where hydroxyapatite has formed, while for all other samples the formation of CaCO 3 appears more likely, which was likely to be influenced by the depletion of HPO − 4 . Secondly, instead of precipitating as a surface layer the Ca precipitates appear to be incorporated into the overall degradation layer. The correlation between Ca and P precipitates is a positive power law indicating that in the presence of both Ca 2+ and HPO − 4 their precipitation coincides. Finally, the positive exponential relationship between degradation rates and all pH measurements may indicate both the influence of a high degradation on the pH evolution, as well as the importance of the initial pH for the degradation itself. However, the former relationship in particular is likely to be influenced by the bulk nature of the pH measurements and would be more conclusive if near-surface measurements were performed.

Degradation prediction
In order to further determine relationships and mechanisms of degradation and precipitation a tree regression analysis was performed. The mean MAE for the prediction of the degradation rate for 50 random forest, extremely randomised trees (Xtree) and decision trees given different training sets is shown in Table B.6. The most accurate predictions were reached by Xtree models with a MAE of 1.35 ± 0.03 mm/ yr. This is a lower error than the mean error of non-linear fits for the correlation of the degradation rate with other parameters, as shown in Fig. 10. Overall, random forest and Xtree models performed robustly well, due to their randomised nature, while the decision tree regression varied strongly. However, certain decision tree models reached a significantly lower MAE of ~1 mm/yr. Utilising solely experimental input parameters to predict the degradation rates resulted in some of the poorest predictions, as shown in Table B.6, while the use of all measured parameters also led to poor predictions. Random forests and decision tree algorithms appeared to perform best when utilising only experimental input, PR and precipitates, while Xtree models performed better when additionally given sample pH measurements.
Initial and control pH at day 7 and precipitation rate were the most important features (weight >0.05) for the prediction of the degradation rate via random forests, while decision trees relied on initial pH at days 7 and 0 and on the precipitation rate. For Xtree models the most important features were sample pH at days 2 and 5, control pH at days 5, 7 and 8, initial pH at day 7 and HPO − 4 concentration. Solutions that resulted in particularly high MAEs were solutions 2a, 10 and 12 for all model types, as well as 5 and 6 for random forests, 6, 15 and 16 for Xtree models and 2, 11 and 7 for decision trees. Notably, many of these are solutions in which HPO − 4 and Ca 2+ were present and for which the pre-precipitation of salts may have played a major role.
In order to generally validate the prediction performance of tree models these were applied to the dataset from Willumeit et al. [11], for which random forest and Xtree models obtained 90% confidence intervals of 0.60-0.65 mm/yr, which was comparable to the performance of the published ANN (0.55 mm/yr). Following the relatively low error from tree models as applied to the dataset from Willumeit et al. [11] it can be assumed that the application of tree models for the prediction of the degradation rate is generally a suitable choice and allows for a more robust analysis of the influence of different input quantities on the predictive power. Therefore, the higher error found for the prediction given the current data highlights the potential existence of an important parameter that was not observed during the experiments and therefore not included in the analysis. While the complex interactions of ions can be described qualitatively, a clear correlation with the change in degradation rate was not possible, therefore making a prediction difficult. This highlights the unique interaction of the four present salts in achieving a metastable solution which leads to a moderate degradation of Mg while allowing for the precipitation of the physiologically relevant hydoxyapatite in the degradation layer. Fig. 10. Non-linear relationships between degradation rate and calcium precipitates or pH measurements, respectively, as well as calcium and phosphate precipitates. The experimental data (blue markers) is fitted utilizing power laws or exponential functions (red dashed line). (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

Conclusion
By studying the degradation of pure Mg in simulated body fluid and its subsets using μCT and SEM+EDX imaging in combination with a subsequent tree regression analysis, we have determined interactions of individual ionic components, namely HCO − 3 , HPO 2− 4 and Ca 2+ , in driving the degradation of Mg and the formation of precipitates as a protective layer. We have shown the importance of the addition of NaCl to SBF to enable the medium's unique degradation and precipitation character, in particular with respect to the formation of hydroxyapatite. Our results support the hypothesis that the presence of Ca 2+ obstructs the interaction between Mg 2+ and HCO − 3 or HPO 2− 4 ions, to such an extent that although the formation of Ca-containing precipitates was kinetically difficult, a formation of Mg precipitates was impossible and therefore little to no protective layer was formed. Based on the correlation between precipitation and degradation rates it may be concluded that for an implantation of an Mg implant into the body, the degradation rate must be controlled to levels below 2 mm/yr to enable the formation of a stable degradation layer to which cells may adhere. Thermodynamic predictions have been shown to provide useful information on forming precipitates, yet more localised pH measurements would be beneficial for their interpretation and comparison to experimental results. We have further shown the potential of non-destructive μCT imaging in analysing the degradation of Mg. The manufacturing of Mg wire for this purpose was of particular importance due to the cylindrical shape which is optimal for μCT imaging. Finally, we have shown that despite the large potential that data science methods bear in the prediction of Mg degradation it was not possible to find a quantitative relationship describing the interaction of the ionic components and other experimental parameters in order to accurately predict Mg degradation. Future experimental research should focus in particular on the interaction of these ionic components by varying concentrations and expand further into the physiologically relevant regime by adding organic compounds, such as proteins and vitamins. The experimental techniques should be expanded to include for example high-resolution transmission electron microscopy to enable a better understanding of the atomic scale processes involved. Moreover, indirect near-surface measurements using atomic force microscopy coupled with scanning electrochemical microscopy may yield in important insight into the electrochemical processes and the effect of the different ionic species thereon. Additionally, atomistic modelling should be undertaken in order to investigate the degradation process as a function of the interaction of Mg with particular ions on a more fundamental level.

Author contributions
The study was conceived and planned by BZP and experiments were conducted by MG and MP as part of their respective M.Sc. theses, which were supervised by BZP. MG prepared the ionic media, adjusted pH and performed the immersion tests and μCT imaging, as well as image processing, segmentation and analysis. MP embedded and ground/polished samples for elemental analysis and performed SEM+EDX imaging, as well as image processing, segmentation and analysis. Further analysis was performed by BZP and the application of machine learning methods was implemented by BB. HS co-supervised MP and SEM+EDX experiments. BW manufactured and supplied the wire and examined the optical micrographs. TW and RM co-supervised MG and the application of machine learning algorithms. The manuscript was written chiefly by BZP with support from all parties.