Skip to content

Commit

Permalink
Save feature_names_out in variable to avoid unnecessary call
Browse files Browse the repository at this point in the history
  • Loading branch information
AVHopp committed Dec 13, 2024
1 parent e1bf3fe commit f9066f8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions baybe/utils/chemistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ def smiles_to_fingerprint_features(
)
name = f"{encoding.name}_"
prefix = prefix + "_" if prefix else ""
no_descriptor_names = all(
"fingerprint" in f for f in fingerprint_encoder.get_feature_names_out()
)
feature_names_out = fingerprint_encoder.get_feature_names_out()
no_descriptor_names = all("fingerprint" in f for f in feature_names_out)
suffixes = [
f.split("fingerprint")[1] if no_descriptor_names else f
for f in fingerprint_encoder.get_feature_names_out()
for f in feature_names_out
]
col_names = [prefix + name + suffix for suffix in suffixes]
df = pd.DataFrame(features, columns=col_names, dtype=DTypeFloatNumpy)
Expand Down

0 comments on commit f9066f8

Please sign in to comment.