fzi-forschungszentrum-informatik / TSInterpret

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

adding train_x variable in SETSTCF for feat mode #71

Closed kndbvortex closed 1 day ago

kndbvortex commented 2 days ago

Hello, i'm currently working with xai for tsc using TSInterpret and @aeon-toolkit/aeon . I tried SET with HIVECOTE2 and face this issue :

[91](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/kndb/Dev/Phd-Code/explainability/MTS/~/Dev/Phd-Code/explainability/MTS/venv/lib/python3.10/site-packages/TSInterpret/InterpretabilityModels/counterfactual/SETSCF.py:91)     # self.train_x = np.array(train_x)
     [92](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/kndb/Dev/Phd-Code/explainability/MTS/~/Dev/Phd-Code/explainability/MTS/venv/lib/python3.10/site-packages/TSInterpret/InterpretabilityModels/counterfactual/SETSCF.py:92)     self.ts_len = train_x.shape[2]
---> [94](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/kndb/Dev/Phd-Code/explainability/MTS/~/Dev/Phd-Code/explainability/MTS/venv/lib/python3.10/site-packages/TSInterpret/InterpretabilityModels/counterfactual/SETSCF.py:94) self.train_x_n = from_3d_numpy_to_nested(self.train_x)
     [95](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/kndb/Dev/Phd-Code/explainability/MTS/~/Dev/Phd-Code/explainability/MTS/venv/lib/python3.10/site-packages/TSInterpret/InterpretabilityModels/counterfactual/SETSCF.py:95) if backend == "PYT":
     [96](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/kndb/Dev/Phd-Code/explainability/MTS/~/Dev/Phd-Code/explainability/MTS/venv/lib/python3.10/site-packages/TSInterpret/InterpretabilityModels/counterfactual/SETSCF.py:96)     self.predict = PyTorchModel(model, change).predict

AttributeError: 'SETSCF' object has no attribute 'train_x'

After looking in the source code i figure out that when the mode == 'feat' you didn't add the train_x variable. I just add it in this PR :).

JHoelli commented 1 day ago

Hi,

thanks for your pull request. :) The sets implementation on PyTorch is still a bit buggy. If you find anything else feel free to let me know or open up another pull request .

kndbvortex commented 19 hours ago

Hi, Ok