Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make rule removal depend on gap in output #22

Merged
merged 23 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">SIRUS.jl</h1>

<h3 align="center">
Explainable machine learning via rule extraction
Interpretable Machine Learning via Rule Extraction
</h3>

<p align="center">
Expand Down
6 changes: 4 additions & 2 deletions docs/src/implementation-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ In other words, this step is ignored because it seems like a premature optimizat

The second step is more important and more involved.
As said before, the second step is to remove the least important linear combinations of other rules.
An example of this is shown in the original paper (Bénard et al., [2021](http://proceedings.mlr.press/v130/benard21a.html), Table 3 (the second) in Section 4 _Post-treatment Illustration_ of the Supplementary PDF), which we repeat here:
An example of this is shown in the original paper (Bénard et al., [2021](http://proceedings.mlr.press/v130/benard21a.html), Table 3 (the second) in Section 4 _Post-treatment Illustration_ of the Supplementary PDF), which is repeated here:

Rule Number | If Clause | Then | Else | Remove | Reason
--- | --- | --- | --- | --- | ---
Expand All @@ -223,13 +223,15 @@ Rule Number | If Clause | Then | Else | Remove | Reason
Compared to the example from the Supplementary PDF, the features are renamed such that 2 = MMAX, 2 = MMIN, 3 = CACH, 4 = CHMIN, and 5 = MYCT and one sign was flipped in rule 14 after email correspondence with Clément.
From this set of rules, the algorithm should remove rule 2, 4, 6, 9, 11, 12, 15, and 17.
This is because rule 2, 4, 6, 9, and 11 are the reverse of an earlier rule and because 12, 15, and 17 are linearly dependent.
For the complex linearly dependent duplicates, remove the rule with the widest gap in the outputs.
In the example above, rule 7 has a wider gap than rule 12, which implies that it has a larger CART-splitting criterion and a higher occurrence frequency.

The implementation for this can be done by converting the training data to a feature space in which each rule becomes a binary feature indicating whether the data point satisfies the constraint or not.
This is quite computationally intensive since there is a lot of duplication in the data and it doesn't guarantee that all cases of duplication will be found since some may not be in the training set.
Luckily, D.W. on StackExchange (https://cs.stackexchange.com/questions/152803) has provided a solution, which I will repeat here.
The idea is to remove each rule ``r`` when it is linearly dependent on the preceding rules.

To do this, observe that a rule of the form ``A \: \& \: B`` can only depend on rules that use some combination of ``A``, ``!A``, ``B``, and/or ``!B``.
To do this, observe that a rule of the form ``A`` can only depend on rules ``A`` or ``!A``, and ``A \: \& \: B`` can only depend on rules that use some combination of ``A``, ``!A``, ``B``, and/or ``!B``.
This works by iteratively calculating the rank and seeing whether the rank increases.

We can assume that we are limited to a set of rules where either `A & B`, `A & !B`, `!A & B`, `!A & !B`, `A`, `!A`, `B`, `!B` or `True`.
Expand Down
Loading