You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: rename macro to aggregated and improve code quality
This commit refactors the evaluation metrics calculation code with the following improvements:
1. Terminology refactoring: macro -> aggregated
- Rename macro_statistics.py to samples_statistics.py
- Rename verify_macro_params.py to verify_aggregated_params.py
- Update all variable and function names accordingly
2. Code structure improvements
- Extract verification logic in plot_ESt.py into separate functions
* compare_single_tolerance_level (12 lines)
* print_verification_result (1 line)
* verify_aggregated_micro_consistency (28 lines, meets ≤30 line requirement)
- Refactor verify_aggregated_params.py to use functional programming style
* Replace structured loops with list comprehensions
* Use Counter for error type counting
* Reduce multiple traversals to single pass where possible
3. Reduce function parameter coupling
- calculate_beta: derive slowdown_speedups internally from correct_speedups
- calculate_lambda: derive correct_count internally from correct_speedups
- calculate_eta: derive statistics internally from correct_speedups
4. Decouple error type handling
- calculate_pi: accept error_type_counts (dict) instead of hardcoded types
- calculate_gamma: accept generic parameters (tolerance, get_pi, errno_tolerances)
- Support user-defined error codes instead of hardcoded error types
5. Code quality improvements
- Use explicit len() checks instead of implicit boolean conversion
- Use modern Python type hints (list/tuple instead of typing.List/Tuple)
- Improve code readability and maintainability
All changes have been verified and pass pre-commit checks.
0 commit comments