def encode_bond_features(self, bond_set):
"""
We break out this function for encoding bond types because it is
reused and occupies several lines.
Parameters:
===========
- bond_set: (set or list) of bonds.
"""
bond_lb = LabelBinarizer()
bond_lb.fit(BOND_TYPES)
bonds = np.zeros(len(BOND_TYPES))
if len(bond_set) > 0:
bond_array = bond_lb.transform([i for i in bond_set])
for b in bond_array:
bonds = bonds + b
return bonds
评论列表
文章目录