# Relaxed Rule-Based Learning for Automated Predictive Maintenance: Proof of Concept
## 2 Relaxed Separate-and-Conquer Rule Learning approach
The new AVP replaces the current one if the precision of \(Rule_{2}\) is greater than the precision of \(Rule_{1}\). Another reason to prefer the new AVP if \(Rule_{2}\) and \(Rule_{1}\) have the same precision but \(Rule_{2}\) has a greater free coverage. In fact, the function is ready to sacrifice precision a little bit for the sake of a greater coverage. In particular, we introduce a parameter _prec_loss_ and consider \(Rule_{2}\) preferable to \(Rule_{1}\) if the precision of \(Rule_{2}\) is at least the precision of \(Rule_{1}\) minus _prec_loss_ but the free coverage is larger. ```
functionChooseNext(\(\mathit{Collection}\), \(Rule\)) \(CurAVP\gets nil\) for each half-interval \(AVP\)do if\(CurAVP=nil\)then ifIsChosen(\(\mathit{Collection}\), \(Rule\), \(AVP\))then \(CurAVP\gets AVP\) endif else if\(IsReplaced(\mathit{Collection}\), \(Rule\), \(CurAVP\), \(AVP\)) then \(CurAVP\gets AVP\) endif endif endfor return\(CurAVP\) endfunction
```
**Algorithm 3** ChooseNext heuristic for RSC approach. **The purpose of parameters. **_init_prec_ allows the whole algorithm to stop even if there is a small percentage of rows with uncovered outcome. In particular, this parameter is used to fight off noise. The parameter _prec_loss_ helps to create rules that are possibly not 100% accurate but have a good coverage. Change of these parameters can affect (positively or negatively) the quality of rule learning. An extensive study of the right choice of parameters for SeCo has been performed in [33; 34]. Studying of the interplay of these parameters for the RSC is left for the future work. **SeCo with the \(\mathit{ChooseNext}\) heuristic. ** Below and in the next section, we use the SeCo method running exactly the \(\mathit{ChooseNext}\) heuristic (Algorithm 2 and 3) as the RSC. The only modification we need is a different way to calculate precision: without taking into account the rows covered by the collection of the existing rules. Let us state this formally. Let \(\mathbf{C}\) be the current collection of rules. Let \(COV(\mathbf{C})=\bigcup_{R\in\mathbf{C}}(POS(R)\cup NEG(R))\). Let \(R\) be a new rule. Let \(FreePOS(R,\mathbf{C})=POS(R)\setminus COV(\mathbf{C})\) and \(FreeNeg(R,\mathbf{C})=NEG(R)\setminus COV(\mathbf{C})\). Let \(free\_prec(R,\mathbf{C})\) be defined as follows. If \(FreePOS(R,\mathbf{C})\cup FreeNeg(R,\mathbf{C})=\varnothing\) then \(free\_prec(R,\mathbf{C})=0\). Otherwise, \(free\_prec(R,\mathbf{C})=|FreePOS(R,\mathbf{C})|/(|FreePOS(R,\mathbf{C})|+| FreeNeg(R,\mathbf{C})|)\). SeCo uses \(free\_prec(R,\mathbf{C})\) instead of \(prec(R)\) and exactly at the same places. ```
functionIsChosen(\(Collection\), \(Rule\), \(AVP\)) \(Rule_{1}=Rule\cup\{AVP\}\) if\(|Free(Rule_{1},Collection)|<init\_free\)then return\(false\) endif if\(prec(Rule_{1})<init\_prec\)then return\(false\) endif functionIsReplaced(\(Collection\), \(Rule\), \(Cur\), \(AVP\)) \(Rule_{1}=Rule\cup\{Cur\)\(AVP\}\) \(Rule_{2}=Rule\cup\{AVP\}\) if\(|Free(Rule_{2},Collection)|<init\_free\)then return\(false\) endif if\(prec(Rule_{2})>prec(Rule_{1})\)then return\(true\) endif if\(prec(Rule_{2})<prec(Rule_{1})-prec\_loss\)then return\(false\) elseif\(Free(Rule_{2},Collection)>Free(Rule_{1},Collection)\)then return\(true\) endif return\(false\) endfunction
```

**Algorithm 3** Two auxiliary functions for ChooseNext heuristic. ### Advantages of RSC versus Methods of Separate-and-Conquer (SeCo) and Weighted Covering

**Definition 7**. : _Let \(\mathbf{C}\) be a collection of rules and let \(R\) be a new rule. We say that \(R\) is reasonable w.r.t. \(\mathbf{C}\) if \(Free(R,\mathbf{C})\
eq\emptyset\)._

The only constraint of the RSC method is that each new rule is reasonable w.r.t. the collection of the previously formed rules. This condition is significantly weaker than that required for SeCo. Indeed, let \(\mathbf{C}\) be a collection of rules and recall that \(COV(\mathbf{C})=\bigcup_{R\in\mathbf{C}}(POS(R)\cup NEG(R))\). The SeCo method, having formed \(\mathbf{C}\) excludes rows \(COV(\mathbf{C})\) from the dataset.