## 2 Materials and Methods
### Global Model Interpretation

Within the global interpretation, Figure 6 shows the SHAP value plot for all training data corresponding to the 1 st postoperative day. The input for this plot is data from Step 3, Algorithm 1. Variables are ranked in descending order, while the horizontal location shows whether the effect of that value is associated with a higher or lower prediction. The vertical ordering of the points for each feature column should reflect the corresponding density

Figure 5: Residuals for the seventh postoperative day prediction. of accumulation. The color shows whether that variable is high or low for that particular observation. Figures 7-9 show the absolute SHAP values averaged over the entire training set corresponding to the 1 st, 4 th, and 7 th postoperative day, respectively. The input for this plot is data from Step 4, Algorithm 1. This bar chart gives us the feature importance, regardless of whether it has a positive or negative effect on the output of the ML model. The numerical values next to each bar indicate the percentage share of the given feature in the entire feature significance pool of the given ML model. The feature subset (V, T, X, K, B, P) is the most important for the patient's postoperative status on the 1 st day after surgery. We took a limit of 5% to be in it. On the 4 th and 7 th day after surgery, these subsets are (V, T, X, K, E1, P), and (T, V, LU, X, P, E1), respectively. Features V (Vital capacity), T (Preoperative FEV1%), X (Forced vital capacity), and P (measure of Chronic Obstructive Pulmonary Disease (COPD) index) appear in all three sets as dominant factors of preoperative lung condition, which is to be expected. What is not intuitively expected is that on the first postoperative day, the features B (age) and K (Body Mass Index) also enter this set, which

Figure 6: SHAP values for all training data corresponding to the 1 st postoperative day. Variables are ranked in descending order, while horizontal location shows whether the effect of that value is associated with a higher or lower prediction. The vertical ordering of the points for each feature column should reflect the corresponding density of accumulation. Color shows whether that variable is high (in red) or low (in blue) for that observation. then lose their significance in the following days. This could be a sign for doctors to pay attention to these two features when preoperatively assessing the patient's future condition immediately after surgery. On the other hand, the appearance of features LU (the number of functional lung segments removed) and E1 (type of surgical procedure) in the set of significant features on the 7 th day after surgery, indicates their importance in the following postoperative period. The number of removed functional segments is a key parameter in classic prognostic systems, see Formulas (6)-(8). Its absence on the 1 st and 4 th day after surgery makes these classic methods inaccurate predictors of the patients' condition on those days. Figure 8: Absolute SHAP values averaged over the entire training set corresponding to the 4 th postoperative day. Figure 7: Absolute SHAP values averaged over the entire training set corresponding to the 1 st postoperative day. In order to illustrate the explanatory possibilities of SHAP, it was important to address the question of whether and how much the postoperative state of patients is influenced by the preoperative state of their muscular support for inhalation. The first step was the identification of relevant features. In the set of our measurements, these were features (CY, DB, EK, EL, FL, GB), see Table 1. The additivity of SHAP values allowed us to quantify the collective impact of this set of features by summing their individual absolute values. We previously showed that _Inspiratory respiration muscles_ (IRM) has a significant impact in the seven-day postoperative period, with its impact being most significant on the first postoperative day [12]. This fact was not known and verified in modern medical practice.