fzi-forschungszentrum-informatik / TSInterpret

An Open-Source Library for the interpretability of time series classifiers
BSD 3-Clause "New" or "Revised" License
115 stars 8 forks source link

Do you have any sort of tutorials on how to run a sklearn model with LEFTIST? [Q] #65

Closed marreapato closed 5 months ago

marreapato commented 5 months ago

First of all i would like to thank the developers and researchers on building this framework. I have successfully used the LEFTIST explanation method with a tensorflow model and that is going to be of good use on my research, however when i implement a random tree classifier i am not able to run the model, i always get this error:

IndexError Traceback (most recent call last) in <cell line: 1>() ----> 1 explanations = leftist.explain(explained_instance,label)

/usr/local/lib/python3.10/dist-packages/TSInterpret/InterpretabilityModels/leftist/leftist.py in explain(self, instance, idx_label, random_state) 117 118 if self.mode == "feat": --> 119 instance = instance.reshape(instance.shape[-1], instance.shape[-2]) 120 else: 121 instance = instance.reshape(instance.shape[-2], instance.shape[-1])

IndexError: tuple index out of range

train_x has shape (150,150) and test_y shape (150), i have changed the shape from (150,150,1) in train x to fit the random forest classifier. I can give more details on my code if need be.

marreapato commented 5 months ago

i Have tried to use the SVM model but unfortunately i can't, even when i try to reply this notebook: https://github.com/fzi-forschungszentrum-informatik/TSInterpret/blob/main/docs/Notebooks/Leftist_sklearn.ipynb

marreapato commented 5 months ago

Oh i have found it here, i should use a timeseries SVC: https://github.com/fzi-forschungszentrum-informatik/TSInterpret/blob/main/docs/Notebooks/Ates_sklearn.ipynb

I am going to close this issue