feature: Update BaseMetric class#63
Merged
pbadillatorrealba merged 1 commit intodevelopfrom Jul 22, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the BaseMetric class to improve input validation, documentation, and parameter handling consistency across the WEFE library. The changes enhance the developer experience by making parameter passing more explicit and removing deprecated functionality.
- Improved input validation with explicit parameter validation instead of using
locals() - Enhanced documentation with comprehensive docstrings for the
BaseMetricclass and methods - Standardized
_check_inputmethod calls across all metric implementations
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| wefe/metrics/base_metric.py | Major refactor of BaseMetric class with improved validation, documentation, and ClassVar type annotations |
| wefe/metrics/WEAT.py | Updated _check_input call to use explicit named parameters |
| wefe/metrics/RNSB.py | Updated _check_input call to use explicit named parameters |
| wefe/metrics/RND.py | Updated _check_input call to use explicit named parameters |
| wefe/metrics/RIPA.py | Updated _check_input call to use explicit named parameters |
| wefe/metrics/MAC.py | Updated _check_input call to use explicit named parameters |
| wefe/metrics/ECT.py | Updated _check_input call to use explicit named parameters |
| tests/metrics/test_base_metric.py | Updated tests to reflect new parameter structure and removed deprecated functionality tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to the
BaseMetricclass and its associated unit tests, as well as updates to therun_querymethod across multiple metric implementations in thewefelibrary. The changes enhance input validation, improve documentation, and refactor the handling of parameters for consistency and clarity.Enhancements to
BaseMetric:Refactored Input Validation:
_check_inputmethod to validate additional parameters (lost_vocabulary_thresholdandwarn_not_found_words) and replaced generic exceptions with more specific ones (TypeErrorandValueError).preprocessor_argsandsecondary_preprocessor_argsremoved for cleaner code.Improved Documentation:
BaseMetricclass and its methods, including attributes and parameter descriptions.Updates to
run_queryMethods:run_querymethods across multiple metric classes (ECT,MAC,RIPA,RND,RNSB,WEAT) to use named parameters (query,model,lost_vocabulary_threshold,warn_not_found_words) for_check_inputcalls, improving readability and consistency.Unit Test Improvements:
tests/metrics/test_base_metric.pyfor clarity and documentation purposes._check_inputmethod and parameter changes.These changes collectively improve code maintainability, enhance developer experience, and ensure stricter validation of inputs across the library.