Skip to content

Conversation

@johnwalz97
Copy link
Contributor

@johnwalz97 johnwalz97 commented Dec 10, 2024

Internal Notes for Reviewers

Initial support for post-processing functions along with an example notebook with a lot of examples.

External Release Notes

Adding support for post-processing functions to allow users to modify test outputs without modifying test code.

@johnwalz97 johnwalz97 added enhancement New feature or request DO NOT MERGE PR is not ready to be merged highlight Feature to be curated in the release notes labels Dec 10, 2024
@johnwalz97 johnwalz97 removed the DO NOT MERGE PR is not ready to be merged label Dec 12, 2024
@johnwalz97 johnwalz97 changed the title [WIP] John6797/sc 7630/spike initial support for post processing Add Initial Support for Post-Processing Functions Dec 12, 2024
@github-actions
Copy link
Contributor

PR Summary

This pull request introduces several enhancements to the ValidMind project, focusing on post-processing capabilities and raw data handling. Key changes include:

  1. Post-Processing Functions: The run_test function now accepts a post_process_fn parameter, allowing users to define custom post-processing functions that modify the TestResult object after a test is run. This enables users to customize test outputs, such as modifying tables, adding/removing tables, and creating figures from tables.

  2. Raw Data Handling: A new RawData class is introduced to encapsulate raw data produced during test execution. This class allows for inspection and serialization of raw data, providing a structured way to handle additional data that is not directly displayed in test results.

  3. Notebook Addition: A new Jupyter notebook, post_processing_functions.ipynb, is added to demonstrate the use of post-processing functions with ValidMind tests. The notebook includes examples of modifying tables, adding/removing tables, creating figures from tables, and more.

  4. Python Version Update: The GitHub Actions workflow is updated to use Python 3.11 instead of 3.8, ensuring compatibility with the latest Python features and improvements.

  5. ROC Curve Enhancement: The ROCCurve test now returns both a RawData object and a Plotly figure, allowing for more flexible post-processing and visualization of ROC curve data.

  6. Code Refactoring: Various code improvements, including the addition of a HumanReadableEncoder for better JSON serialization of numpy arrays, and refactoring of figure handling logic to support multiple figure types.

These changes enhance the flexibility and usability of the ValidMind library, allowing for more customized and detailed test result handling.

Test Suggestions

  • Test the new post-processing function capability by creating a custom function that modifies a test result and verify the changes.
  • Verify that the RawData class correctly encapsulates and serializes raw data from a test.
  • Run the post_processing_functions.ipynb notebook to ensure all examples execute without errors and produce the expected outputs.
  • Test the updated ROCCurve test to ensure it returns both the RawData and the Plotly figure correctly.
  • Check the GitHub Actions workflow to confirm it runs successfully with Python 3.11.

Copy link
Contributor

@AnilSorathiya AnilSorathiya left a comment

Choose a reason for hiding this comment

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

@johnwalz97 Awesome 👍
There are a couple of things:

  1. Are we using key anywhere? If not why don't we create separate ticket get rid off it?
  2. Do we need ref_id for RawData to access it on platform/frontend? Since we are using ref_id for tables and figures.

@johnwalz97
Copy link
Contributor Author

@johnwalz97 Awesome 👍

There are a couple of things:

  1. Are we using key anywhere? If not why don't we create separate ticket get rid off it?

  2. Do we need ref_id for RawData to access it on platform/frontend? Since we are using ref_id for tables and figures.

Thanks for reviewing @AnilSorathiya

  1. Thats a great idea, I can add a ticket for that.
  2. We don't need it yet since ref_id is only used to link figures to test results on the backend (since they are logged stored separately in the DB). If we ever start storing raw_data outside of the test_results table than we can add it.

@AnilSorathiya AnilSorathiya self-requested a review December 12, 2024 22:18
Copy link
Contributor

@AnilSorathiya AnilSorathiya left a comment

Choose a reason for hiding this comment

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

left one last comment otherwise it looks good.

@johnwalz97 johnwalz97 merged commit f53c9e0 into main Dec 13, 2024
5 checks passed
@johnwalz97 johnwalz97 deleted the john6797/sc-7630/spike-initial-support-for-post-processing branch December 13, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request highlight Feature to be curated in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants