dgllife.utils.PAGTNEdgeFeaturizer¶
-
class
dgllife.utils.
PAGTNEdgeFeaturizer
(bond_data_field='e', max_length=5)[source]¶ The edge featurizer used in PAGTN
PAGTN is introduced in Path-Augmented Graph Transformer Network.
We build a complete graph and the edge features include: * Shortest path between two nodes in terms of bonds. To encode the path,
we encode each bond on the path and concatenate their encodings. The encoding of a bond contains information about the bond type, whether the bond is conjugated and whether the bond is in a ring.
One hot encoding of type of rings based on size and aromaticity.
One hot encoding of the distance between the nodes.
We assume the resulting DGLGraph will be created with :func:`smiles_to_complete_graph` with self loops.
- Parameters
Examples
>>> from dgllife.utils import PAGTNEdgeFeaturizer >>> from rdkit import Chem >>> mol = Chem.MolFromSmiles('CCO') >>> bond_featurizer = PAGTNEdgeFeaturizer(max_length=1) >>> bond_featurizer(mol) {'e': tensor([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]])} >>> # Get feature size >>> bond_featurizer.feat_size() 14
See also
BaseBondFeaturizer
,CanonicalBondFeaturizer
,WeaveEdgeFeaturizer
,PretrainBondFeaturizer
,AttentiveFPBondFeaturizer
-
__init__
(bond_data_field='e', max_length=5)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([bond_data_field, max_length])Initialize self.
bond_features
(mol, path_atoms, ring_info)Computes the edge features for a given pair of nodes.
Get the feature size.