-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: moltochemprop not compatible with chemprop 2.0.3 (#37)
adapt to chemprop 2.0.3
- Loading branch information
1 parent
41bb336
commit 58984cd
Showing
7 changed files
with
162 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Wrapper for Chemprop Featurizer.""" |
52 changes: 52 additions & 0 deletions
52
molpipeline/estimators/chemprop/featurizer_wrapper/graph_wrapper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Wrapper for Chemprop GraphFeaturizer.""" | ||
|
||
from dataclasses import InitVar | ||
from typing import Any | ||
|
||
try: | ||
from typing import Self # type: ignore[attr-defined] | ||
except ImportError: | ||
from typing_extensions import Self | ||
|
||
from chemprop.featurizers.molgraph import ( | ||
SimpleMoleculeMolGraphFeaturizer as _SimpleMoleculeMolGraphFeaturizer, | ||
) | ||
|
||
|
||
class SimpleMoleculeMolGraphFeaturizer(_SimpleMoleculeMolGraphFeaturizer): | ||
"""Wrapper for Chemprop SimpleMoleculeMolGraphFeaturizer.""" | ||
|
||
extra_atom_fdim: InitVar[int] | ||
extra_bond_fdim: InitVar[int] | ||
|
||
def get_params( | ||
self, deep: bool = True # pylint: disable=unused-argument | ||
) -> dict[str, InitVar[int]]: | ||
"""Get parameters for the featurizer. | ||
Parameters | ||
---------- | ||
deep: bool, optional (default=True) | ||
Used for compatibility with scikit-learn. | ||
Returns | ||
------- | ||
dict[str, int] | ||
Parameters of the featurizer. | ||
""" | ||
return {} | ||
|
||
def set_params(self, **parameters: Any) -> Self: # pylint: disable=unused-argument | ||
"""Set the parameters of the featurizer. | ||
Parameters | ||
---------- | ||
parameters: Any | ||
Parameters to set. Only used for compatibility with scikit-learn. | ||
Returns | ||
------- | ||
Self | ||
This featurizer with the parameters set. | ||
""" | ||
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
chemprop >= 2.0.0, < 2.0.3 | ||
chemprop>=2.0.3 | ||
lightning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters