# Recommendation Algorithm Based on Survival Action Rules
## 3 Methods
### Survival Action Rule Induction  
In this section, we provide a brief overview of our algorithm proposed in [2] for generating an action rule set to be applied to the analysis of censored data (see Algorithm 1). The rule set consists of survival action rules. The algorithm is essential for understanding the subsequent content. Figure 1: Synthetic data—Kaplan-Meier plots for two groups \(S_{1}\) and \(S_{2}\) used in the illustrative example of survival action rules concept. Algorithm 1 outlines the main loop that implements rule set induction. In each loop, a new rule is formed through a two-step process: first, the rule is specialized (referenced in line 5 of Algorithm 1), and then it is pruned (mentioned in line 6 of the same algorithm). The loop run ends with the elimination of the examples that the newly formed rule covers from the pool of examples yet to be covered (line 9). If the process of creating a rule yields one with no conditions in its premise, such a rule is excluded from the final set of rules (line 7), signaling that it is impossible to derive a new actionable rule. The process of rule induction terminates when such an empty rule, which applies to all examples in the dataset \(D\), is formed. When comparing the source and target survival curves, it is clear that their relative positions are not constant. The log-rank measure [6] does not take into account the relative position of these curves. It is a symmetric measure that only gives the maximum distance between the curves. In contrast, the proposed algorithm can generate three types of rules: improving (i.e., seeking actions that increase survival), worsening (i.e., seeking rules that decrease survival), and arbitrary rules (i.e., allowing the simultaneous induction of both types of rules). The type of rules generated is determined by the run mode--an algorithm's parameter. During the induction of a new action rule, the area under the survival curve and the survival probability (using the Kaplan-Meier estimator) are measured. For the improving rule, both the area and the probability of the target rule should be higher, whereas for the worsening rule, both parameters should be lower. The most important phase in the induction of a survival action rule is the specialization phase, illustrated in Algorithm 2. ```
0:\(D(A,T,\delta)\)--a dataset described by attributes \(A\), observation time \(T\), and survival status \(\delta\)\(P\)--a set of input parameters \(A_{s}\)--a set of stable attributes from the set A
0:\(R\)--a set of survival action rules
1:functionInductionOfSurvivalActionRules(\(D,P\))
2:\(R\leftarrow\textit{empty set}\)
3:\(D_{u}\gets D\)\(\triangleright\) a set of examples that are not covered
4:while\(D_{u}\
eq\emptyset\)do
5:\(r\leftarrow\textsc{Specialize(}D_{u},P,A_{s}\texttt{)}\)
6:\(r\leftarrow\textsc{Prune(}D_{u},r,P\texttt{)}\)
7:if\(r\
eq\emptyset\)then\(R\).Insert(\(r\))
8:\(D_{c}\leftarrow\textsc{CoveredExamples(}r,D_{u}\texttt{)}\)\(\triangleright\) this function returns examples from the set \(D\) covered by rule \(r\)
9:\(D_{u}\gets D_{u}\setminus D_{c}\)
10:endwhile
11:return\(R\)
12:endfunction
```  
**Algorithm 1** An action rule set induction algorithm for censored data. The process of rule specialization involves adding successive actions into the rule's premise, which is initially empty (lines 10-13 of Algorithm 2). These actions derive from two elementary conditions identified during the specialization. The first is the best elementary condition to include in the rule's source part (line 5), and the second is the best counter-condition or the best elementary condition for the rule's target part (line 9). Specialization finishes when no further best elementary condition can be found for the rule's source. Identifying the best elementary condition (line 5) involves finding a condition that, once added to the action rule's source premise, yields the highest quality survival rule.