aeon icon indicating copy to clipboard operation
aeon copied to clipboard

Fixed the Messy code that needed too many paramenters

Open PravasMohanty opened this issue 8 months ago • 2 comments

Reference Issues/PRs

Fixes #2650. This PR addresses the issue of simplifying the create_multi_comparison_matrix function by improving its parameters and saving functionality.

What does this implement/fix? Explain your changes.

This PR simplifies the create_multi_comparison_matrix function by reducing the number of parameters required for saving files and ordering results. Specifically:

1. File Saving Simplification:

Replaced multiple parameters (pdf_savename, png_savename, etc.) with a single save_files dictionary. Users can now specify the file format and name as key-value pairs (e.g., {"pdf": "output.pdf", "png": "output.png"}). This reduces clutter and improves usability.

2. Ordering Parameters Simplification:

Consolidated order_win_tie_loss and order_better into a single order_settings dictionary (e.g., {"win_tie_loss": "higher", "better": "decreasing"}). This makes the function more intuitive and easier to use.

3. Added Logging:

Introduced logging to improve tracking of function execution and debugging. Key steps (e.g., loading data, performing analysis, saving files) are now logged for better visibility and troubleshooting.

These changes improve usability, maintainability, and reduce the cognitive load on users while addressing the concerns raised in issue #2650.

Does your contribution introduce a new dependency? If yes, which one?

No new dependencies are introduced. The logging module is part of Python's standard library.

Any other comments?

The changes are backward-compatible, as the new save_files and order_settings parameters replace older parameters without breaking existing functionality.

Logging has been added to enhance debugging and monitoring capabilities.

The updated function has been tested with various file formats and ordering configurations to ensure robustness.

Example Usage

fig = create_multi_comparison_matrix( df_results="results.csv", save_files={"pdf": "output.pdf", "png": "output.png"}, order_settings={"win_tie_loss": "higher", "better": "decreasing"}, used_statistic="Accuracy", dataset_column="dataset_name", )

Linked Issue

This PR directly addresses issue #2650, which highlighted the need to simplify the create_multi_comparison_matrix function's parameters and saving functionality. The changes proposed here resolve the issue by making the function more user-friendly and maintainable.

PravasMohanty avatar Mar 21 '25 13:03 PravasMohanty

Thank you for contributing to aeon

I did not find any labels to add based on the title. Please add the [ENH], [MNT], [BUG], [DOC], [REF], [DEP] and/or [GOV] tags to your pull requests titles. For now you can add the labels manually. I have added the following labels to this PR based on the changes made: [ $\color{#0e8a16}{\textsf{segmentation}}$, $\color{#FBCA04}{\textsf{visualisation}}$ ]. Feel free to change these if they do not properly represent the PR.

The Checks tab will show the status of our automated tests. You can click on individual test runs in the tab or "Details" in the panel below to see more information if there is a failure.

If our pre-commit code quality check fails, any trivial fixes will automatically be pushed to your PR unless it is a draft.

Don't hesitate to ask questions on the aeon Slack channel if you have any.

PR CI actions

These checkboxes will add labels to enable/disable CI functionality for this PR. This may not take effect immediately, and a new commit may be required to run the new configuration.

  • [ ] Run pre-commit checks for all files
  • [ ] Run mypy typecheck tests
  • [ ] Run all pytest tests and configurations
  • [ ] Run all notebook example tests
  • [ ] Run numba-disabled codecov tests
  • [ ] Stop automatic pre-commit fixes (always disabled for drafts)
  • [ ] Disable numba cache loading
  • [ ] Push an empty commit to re-run CI checks

aeon-actions-bot[bot] avatar Mar 21 '25 13:03 aeon-actions-bot[bot]

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Closing as this is a duplicate. If you contribute in the future please use a more helpful PR title.

MatthewMiddlehurst avatar May 25 '25 17:05 MatthewMiddlehurst