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

Fixed the Messy code that needed too many paramenters #2669

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

PravasMohanty
Copy link

@PravasMohanty PravasMohanty commented Mar 21, 2025

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.

@aeon-actions-bot aeon-actions-bot bot added segmentation Segmentation package visualisation Visualisation module labels Mar 21, 2025
@aeon-actions-bot
Copy link
Contributor

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

@PravasMohanty PravasMohanty requested a review from a team as a code owner March 21, 2025 15:32
@PravasMohanty PravasMohanty force-pushed the pravasbranch branch 3 times, most recently from 0ba142c to fd0292d Compare March 22, 2025 16:15
@MatthewMiddlehurst MatthewMiddlehurst added enhancement New feature, improvement request or other non-bug code enhancement and removed segmentation Segmentation package labels Mar 22, 2025
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, improvement request or other non-bug code enhancement visualisation Visualisation module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] Improve create_multi_comparison_matrix parameters and saving
2 participants