I have a simple NN for binary classification:
self.layer1 = nn.Linear(44, 128)
self.layer2 = nn.Linear(128, 512)
self.layer3 = nn.Linear(512, 1024)
self.layer4 = nn.Linear(1024, 512)
self.layer5 = nn.Linear(512, 128)
self.layer6 = nn.Linear(128, 40)
self.layer7 = nn.Linear(40, 1)
which gets 44 input features (some of them zeros) for training and outputs a classification score. It is trained sensibly and results in low loss (<0.1) and good classification power.
I would like to check which of those 44 features are most important i.e. how each one contributed to the minimisation of the loss function during training. I’ve heard of methods to rank input variables on a par with their relative contribution.
Can someone please explain how to implement this in PyTorch? A minimal code snippet which performs some computation based on trained_net.parameters()
perhaps?
Many thanks in advance!