deepchem icon indicating copy to clipboard operation
deepchem copied to clipboard

Refactoring FCNet

Open shivance opened this issue 1 year ago • 2 comments

🚀 Feature

File : deepchem/models/fcnet.py

Motivation

MultiTaskClassifier and MultiTaskRegressor have a subclass PyTorchImpl which implements a torch.nn.Module If we decouple this subclass from TorchModel wrapper as in #2963 , the class can be reused as PyTorch Linear Layer for other future use cases of deepchem

Additionally, we should move this file from deepchem/models/ to deepchem/models/torch_models/

shivance avatar Jul 27 '22 05:07 shivance

@peastman do you think refactoring is reasonable?

shivance avatar Jul 27 '22 16:07 shivance

The code looks pretty specific to these models. Extracting it would make it more complicated (for example, it couldn't refer to variables in the surrounding scope anymore), and some parts of it (like uncertainty prediction) aren't relevant to other uses.

If you want to use one of these models as a building block for a larger model, I would use it directly. Something like this.

classifier = MultitaskClassifier(...)
...
outputs = classifier.model(input)

peastman avatar Jul 27 '22 19:07 peastman