Open franciscomalveiro opened 1 year ago
I took a look at the source code, and found the following:
The problem appears at
https://github.com/cloudbopper/anamod/blob/556e2478517c9bd71db2f4c40990d1f6edfa1623/anamod/core/perturbations.py#L102
The assert clause fails given that perturbed_slice.base = None
.
perturbed_slice
is generated by https://github.com/cloudbopper/anamod/blob/556e2478517c9bd71db2f4c40990d1f6edfa1623/anamod/core/perturbations.py#L98
perturbed_slice.base
is X_hat
, unless it enters in the following block
https://github.com/cloudbopper/anamod/blob/556e2478517c9bd71db2f4c40990d1f6edfa1623/anamod/core/perturbations.py#L46-L48
When the code reaches, this block, perturbed_slice.base = None
and for that reason the assert clause fails.
I've noticed the comment you have left there, so maybe there is something missing in the implementation...?
Hello! First of all, thank you for the development of this project. I've been (trying to) use it to extract feature importance of LSTM and Transformer models, but I've stumbled on an
assert
clause that stops the process.More specifically:
When no features are considered important, it all goes smoothly, displaying on the terminal:
No important features identified, skipping window feature importance window visualization.
However, when the framework detects important features, it hits an assert clause, this one: https://github.com/cloudbopper/anamod/blob/556e2478517c9bd71db2f4c40990d1f6edfa1623/anamod/core/perturbations.py#L102
perturbed_slice.base
isNone
, where, according to theassert
clause, it should be, as it indicates,X_hat
. For that reason, the process stops.Following the guidelines you provide at Contributions:
To try to find out the issue (it could reside on my data, models or model wrapper), I've tried to replicate the problem solely with the functions you provide:
Changing the value of
fraction_relevant_features
toggles between working and not working:fraction_relevant_features = 0.1
makes the analyser detect no important features, and for that reason concludes successfully;fraction_relevant_features = 0.9
makes the program hit theassert
clause.PS: To check whether that would be the single problem in the process, I have tried commenting that
assert
clause. The process then finishes, but displaying a «deformed» plot .However the results may not be correct ones (the assert was there probably for a reason...) It would be nice if the plot size was adjusted accordingly, or to be set beforehand, to avoid this.
Thanks!