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

[PNE-6367] Add support for feature effects. #982

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

anoto-moniz
Copy link
Collaborator

The payload comes in as a condensed format, so it's expanded in order to contructed nested lists of objects for clarity and ease of use.

Additionally, the hierarchy of data is flipped to more closely match how it will be used by our customers. To that end, 'as_dict' is provided to ease importing it into a pandas DataFrame for whatever processing and analysis the customer desires.

PR Type:

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Maintenance (non-breaking change to assist developers)

Adherence to team decisions

  • I have added tests for 100% coverage
  • I have written Numpy-style docstrings for every method and class.
  • I have communicated the downstream consequences of the PR to others.
  • I have bumped the version in __version__.py

@@ -88,6 +88,7 @@ class TableConfig(Resource["TableConfig"]):
The query used to define the materials underpinning this table
generation_algorithm: TableFromGemdQueryAlgorithm
Which algorithm was used to generate the config based on the GemdQuery results

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My local flake8 was complaining about this file, despite me not touching it. 🤷‍♂️

@anoto-moniz anoto-moniz force-pushed the feature/pne-6367-feature-effects branch from 1d2b4cb to 8a16228 Compare November 22, 2024 19:10
@anoto-moniz anoto-moniz marked this pull request as ready for review November 22, 2024 19:13
@anoto-moniz anoto-moniz requested a review from a team as a code owner November 22, 2024 19:13
The payload comes in as a condensed format, so it's expanded in order to
constructed nested lists of objects for clarity and ease of use.

Additionally, the hierarchy of data is flipped to more closely match how
it will be used by our customers. To that end, 'as_dict' is provided to
ease importing it into a pandas DataFrame for whatever processing and
analysis the customer desires.
@anoto-moniz anoto-moniz force-pushed the feature/pne-6367-feature-effects branch from 8a16228 to 623a307 Compare November 26, 2024 20:41
Copy link
Collaborator

@kroenlein kroenlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly good. I have a concern about a sig change.

Comment on lines +73 to +76
@property
def as_dict(self) -> Dict[str, Dict[str, Dict[UUID, float]]]:
"""Presents the feature effects as a dictionary by output."""
return {output.output: output.feature_dict for output in self.outputs}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource.py supports an as_dict method that is not a property. Does it need to be a property? I'm concerned about changing the signature on a derived class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resource doesn't define as_dict, just GEMDResource.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. Not a sig collision.

Choice of property or method doesn't seem to have a consistent flavor in the library. This feels more like a method to me than a property, but acceptable as is if you feel strongly to the contrary.

@anoto-moniz anoto-moniz merged commit 556ce5f into main Dec 11, 2024
17 checks passed
@anoto-moniz anoto-moniz deleted the feature/pne-6367-feature-effects branch December 11, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants