1

I would like to use a feedforward neural network as a model to classify samples into 8 classes. Since I'm working with gene expression data I was thinking to implement something like PASNET. They use different ML techniques, but I'm just interested in the permanent pruning of weights between the input layer and the first hidden layer. To be more specific, I want to implement a feedforward neural network with 2 hidden layers, where some specified weights between the input and first hidden layer are deleted w.r.t a given binary (N,M)-Matrix. N describes the number of nodes in the first hidden layer and M the number of nodes in the input layer (e.g the cell matrix[10][3] tells us whether the weight between the third input node and the tenth node of the first hidden layer should exist 1 or not 0). All other layers should be fully connected. I drew it in case I explain it poorly: My drawing

The authors of the paper published their code (they used pytorch), but since their code is mixed up with other ML techniques, I would like to implement it myself. The authors successfully implemented that with pytorch and it looks like for me that they created a fully connected NN and multiplicated (element-wise) the weights between the input and first hidden layer with the binary-matrix before every feedforward and backpropagation iteration. If that is the way to go I would look more into it myself but maybe there is a package/framework which does the job faster and easier. I usually work with sklearn and would like to use it if possible but I couldn't find a way. Big plus if the suggested approach is easily extendable with methods for minimizing overfitting (e.g regularization, drop out).

Thank you!

1
  • No, there is no standard package to do this. You would have to either use the way that authors of the said paper did it --- "multiply each weight with mask". There are many ways to do it --- you can do it explicitly in forwarding calls of your network. Or extend the existing layer to create custom layers. Extending the layers can have some advantages of avoiding repetitive code and more intuitive API. Commented Jan 16, 2022 at 18:20

1 Answer 1

0

Pytorch already has built in pruning related package. The tutorial refers to https://pytorch.org/tutorials/intermediate/pruning_tutorial.html.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.