Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils/mol2concatinated_vector: changes for xai #33

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions molpipeline/mol2any/mol2concatinated_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ def element_list(self) -> list[tuple[str, MolToAnyPipelineElement]]:
"""Get pipeline elements."""
return self._element_list

@property
def n_features(self) -> int:
"""Calculates and returns the number of features."""
feature_count = 0
for _, element in self._element_list:
if hasattr(element, "n_features"):
feature_count += element.n_features
elif hasattr(element, "n_bits"):
feature_count += element.n_bits
else:
raise AssertionError(
f"Element {element} does not have n_features or n_bits."
)
return feature_count

def get_params(self, deep: bool = True) -> dict[str, Any]:
"""Return all parameters defining the object.

Expand Down
Loading
Loading