dreamquark-ai / tabnet

PyTorch implementation of TabNet paper : https://arxiv.org/pdf/1908.07442.pdf
https://dreamquark-ai.github.io/tabnet/
MIT License
2.55k stars 470 forks source link

Not able to use compute_importance with fit method of tabnet classifier #511

Closed madihasamo97 closed 10 months ago

madihasamo97 commented 10 months ago

I am trying to compute feature importance in TabNet classifier but I am not able to use compute_importance parameter with fit method of TabNet classifier. It throws TypeError: fit() got an unexpected keyword argument 'compute_importance'. Ignoring this parameter I then directly tried getting feature importance but it again said it the model has no attribute to get feature importance

What is the current behavior? I get the TypeError while trying to use compute_importance parameter with the fit parameter as mentioned in the original site. Here is the summary of my pytorchtabnet: Name: pytorch-tabnet Version: 4.0 Summary: PyTorch implementation of TabNet Home-page: https://github.com/dreamquark-ai/tabnet Location: c:\anaconda\lib\site-packages_ Requires: numpy, scikit_learn, scipy, torch, tqdm

If the current behavior is a bug, please provide the steps to reproduce.

  1. Go to Jupyter Notebook and import pytorch-tabnet
  2. Get any classifier and try using compute_importance parameter with fit method.
  3. Scroll down to the terminal it will probs throw error.

Expected behavior It should compute feature importance and provide me with mask/values to visualize and interpret the TabNet model and it's feature importance. Screenshots

image

Other relevant information: python version: 3.9.13 Operating System: Windows 10 (throws same error in Amazon Linux 2) Additional tools: JupyterHub (v1.4.1)

eduardocarvp commented 10 months ago

Hi @madihasamo97,

It seems this parameter was added on the last release, that is version 4.1.0. Can you try upgrading the package version and trying again?

madihasamo97 commented 10 months ago

Hi. Yes, upgrading the package worked. I somehow missed that and thought I had the latest version. Thanks very much anyways

eduardocarvp commented 10 months ago

No worries :) I'm closing this issue then!