# Recommendation Algorithm Based on Survival Action Rules
## 4 Experiments and Results
### Case Studies
#### 4.1.2 Comparative Study  
Dataset  
Both counterfactual and recommendation methods were applied to the entire maintenance dataset. Each experiment was conducted using a 10-fold stratified cross-validation approach. With a total of 1000 samples in the dataset, the training set consisted of 900 samples, and the test set consisted of 100 samples for each fold. Subsequent analyses were performed on a combined total of 1000 test samples from all folds. The recommendation algorithm was applied using the same parameters as in the previous experiments, specifically setting the minimum number of examples covered by a single rule to 30. The counterfactual explanation method was applied for both \(\theta\) values of \(-1\) and \(1\), with the Random Survival Forest model selected for analysis. This resulted in three sets of results: one from the recommendation algorithm, one from the counterfactual explanations with \(\theta=1\), and one from the counterfactual explanations with \(\theta=0\). For each test sample, a survival curve was constructed using the Random Survival Forest method. Similarly, for each recommendation, a mutated sample was obtained, and a survival curve was created using the same method. These curves were then compared using the two-sample K-S test, which provided a pair of results: the \(p\)-value and the test statistic. Small \(p\)-values indicate that the survival curve of the test sample is different from the survival curve of the test sample mutated according to the recommendation, which means that the change applied by the method is significant. In this experimental setup, our goal was to obtain a \(p\)-value below the 0.05 significance threshold. A test yielding such a result indicates a significant difference between the survival curve of the original test sample and the curve of the modified test sample, based on the recommendation. This indicates that the recommended change is substantial. The results are presented in Figure 6. The histograms show a predominance of lower \(p\)-values for all methods. Detailed results in the form of a share of recommendations that achieved a \(p\)-value lower than 0.05 are presented in Table 11. Better results were achieved for the counterfactual method, but the computation time was significantly longer, as shown in Table 12. \begin{table}
\begin{tabular}{l l} \hline \hline
**Id** & **Recommendation** \\ \hline
73 & (temperatureInd, (79.57, 85.54) \(\rightarrow\) (45.46, 106.14)) \\ \(\wedge\) (moistureInd, (106.22, 110.00) \(\rightarrow\) (112.84, 114.75)) \\
74 & (temperatureInd, (86.82, 106.14) \(\rightarrow\) (85.54, 86.82)) \\
75 & (temperatureInd, (61.19, 68.84) \(\rightarrow\) (70.81, 160.28)) \\ \(\wedge\) (moistureInd, (94.84, 99.71) \(\rightarrow\) (94.21, 94.83)) \\
76 & (temperatureInd, (106.64, 108.03) \(\rightarrow\) (85.54, 86.82)) \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Selected recommendations for examples from the maintenance dataset. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**PressureInd** & **MoistureInd** & **TemperatureInd** & **Time** & **Status** \\ \hline
57.46 & 104.98 & 100.53 & 12 & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Characteristics of the test example \(x\). \begin{table}
\begin{tabular}{l c} \hline \hline
**Method** & **\(p\)-Value \(\leq\) 0.05** \\ \hline recommendation algorithm & 60.8 \\ counterfactuals (\(\theta=1\)) & 81.1 \\ counterfactuals (\(\theta=-1\)) & 74.7 \\ \hline \hline \end{tabular}
\end{table} 
Table 11: Comparison of methods based on the significance of \(p\)-value. The column \(P_{0.05}\) represents the percentage of recommendations with a \(p\)-value less than 0.05. \begin{table}
\begin{tabular}{l c c} \hline \hline
**PressureInd** & **MoistureInd** & **TemperatureInd** \\ \hline
57.46 & 104.98 & 86.25 \\ \hline \hline \end{tabular}
\end{table} 
Table 13: Recommendation for the example \(x\).