Hi here,
I got stuck with using MPNNModel with MolGraphConvFeaturizer which is known to be acceptable featurizer for MPNNModel. If I do model.fit()
, then I get AttributeError: 'GraphData' object has no attribute 'num_atoms'
. I used the following codes:
featurizer = dc.feat.MolGraphConvFeaturizer()
_feature = featurizer.featurize(input_pd['smiles'].to_list())
train_dataset = dc.data.NumpyDataset(X=_feature, y=input_pd['property'].to_list())
model = dc.models.MPNNModel(n_tasks=1, mode = 'regression')
model.fit(train_dataset, nb_epoch=50)
And it's error as below:
1174 start = 0
1175 for im, mol in enumerate(X_b):
-> 1176 n_atoms = mol.get_num_atoms()
1177 # number of atoms in each molecule
1178 atom_split.extend([im] * n_atoms)
AttributeError: 'GraphData' object has no attribute 'get_num_atoms'
MolGraphConvModel
but the default TF one uses WeaveModel
https://github.com/deepchem/deepchem/blob/master/deepchem/models/tests/test_graph_models.py#L258
Modeling_Protein_Ligand_Interactions_With_Atomic_Convolutions.ipynb
notebook but when running acm.fit(train, nb_epoch=max_epochs, max_checkpoints_to_keep=1, callbacks=[val_cb])
I get ValueError: could not broadcast input array from shape (154,) into shape (1,)
(I tested on colab and in a local containter, same error in both). Is there any change of the imported data size?
I am planning to contribute to deepchem for the first time. I am trying to port LSTMStep to PyTorch as first step. Precommit hooks like flake8 are failing due to changes which I haven't made (as below). Is there any general procedure in such scenarios? Should I fix these checks or is there any way to ignore these and proceed with commit and push
deepchem/models/tests/test_layers.py:8:3: F401 'tensorflow.python.framework.test_util' imported but unused
deepchem/models/tests/test_layers.py:124:3: F841 local variable 'out_channels' is assigned to but never used
deepchem/models/tests/test_layers.py:169:3: F841 local variable 'out_channels' is assigned to but never used
deepchem/models/tests/test_layers.py:211:3: F401 'tensorflow as tf' imported but unused
deepchem/models/tests/test_layers.py:213:3: F841 local variable 'out_channels' is assigned to but never used
deepchem/models/tests/test_layers.py:232:3: E265 block comment should start with '# '
deepchem/models/tests/test_layers.py:239:3: E265 block comment should start with '# '
deepchem/models/tests/test_layers.py:290:3: F841 local variable 'n_atoms' is assigned to but never used
deepchem/models/tests/test_layers.py:310:3: F841 local variable 'max_depth' is assigned to but never used
deepchem/models/tests/test_layers.py:501:3: F841 local variable 'result' is assigned to but never used
deepchem/models/tests/test_layers.py:574:3: E265 block comment should start with '# '
deepchem/models/tests/test_layers.py:579:3: F841 local variable 'outputs' is assigned to but never used
deepchem/models/tests/test_layers.py:585:7: E265 block comment should start with '# '
deepchem/models/tests/test_layers.py:587:3: E266 too many leading '#' for block comment
deepchem/models/tests/test_layers.py:588:3: E266 too many leading '#' for block comment
deepchem/models/tests/test_layers.py:608:3: F841 local variable 'outputs' is assigned to but never used
Thanks for the wonderful resource. I'm having a few issues with Sklearn models. Most of them work fine but I get the following error only with GaussianProcessClassifier, KNeighborsClassifier, MLPClassifier and QuadraticDiscriminantAnalysis (i.e., RandomForestClassifier works fine and gives the expected output, for example)
TypeError Traceback (most recent call last)
/tmp/ipykernel_29886/3380587234.py in <cell line: 2>()
1 model = dc.models.SklearnModel(GaussianProcessClassifier())
----> 2 model.fit(train_dataset)
3 model.predict(test_dataset)
~/anaconda3/envs/tensorflow2_p38/lib/python3.8/site-packages/deepchem/models/sklearn_models/sklearn_model.py in fit(self, dataset)
109 # Some scikit-learn models don't use weights.
110 if self.use_weights:
--> 111 self.model.fit(X, y, w)
112 return
113 self.model.fit(X, y)
TypeError: fit() takes 3 positional arguments but 4 were given
Any ideas what's going wrong here?