Skip to content

Commit

Permalink
Ran pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AntObi committed Sep 15, 2023
1 parent d1b29d4 commit 9fb67f7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions skipatom/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def sum_pool(comp: Composition, dictionary: dict, embeddings: list) -> np.ndarra
return np.sum(vectors, axis=0).tolist()


def mean_pool(comp: Composition, dictionary: dict, embeddings: list, species_mode:bool = False) -> np.ndarray:
def mean_pool(
comp: Composition, dictionary: dict, embeddings: list, species_mode: bool = False
) -> np.ndarray:
"""
Returns a mean-pooled distributed representation of the given composition using the given embeddings.
Expand All @@ -92,9 +94,11 @@ def mean_pool(comp: Composition, dictionary: dict, embeddings: list, species_mod
for e in comp.elements:
if species_mode:
amount = float(comp.to_reduced_dict[e.to_pretty_string()])
vectors.append(amount * np.array(embeddings[dictionary[e.to_pretty_string()]]))
vectors.append(
amount * np.array(embeddings[dictionary[e.to_pretty_string()]])
)
tot_amount += amount
else:
else:
amount = float(comp.to_reduced_dict[e.name])
vectors.append(amount * np.array(embeddings[dictionary[e.name]]))
tot_amount += amount
Expand Down

0 comments on commit 9fb67f7

Please sign in to comment.