Skip to content

feature: Update BaseMetric class#63

Merged
pbadillatorrealba merged 1 commit intodevelopfrom
feature/improve_base_metric
Jul 22, 2025
Merged

feature: Update BaseMetric class#63
pbadillatorrealba merged 1 commit intodevelopfrom
feature/improve_base_metric

Conversation

@pbadillatorrealba
Copy link
Member

This pull request introduces significant improvements to the BaseMetric class and its associated unit tests, as well as updates to the run_query method across multiple metric implementations in the wefe library. The changes enhance input validation, improve documentation, and refactor the handling of parameters for consistency and clarity.

Enhancements to BaseMetric:

  • Refactored Input Validation:

    • Updated _check_input method to validate additional parameters (lost_vocabulary_threshold and warn_not_found_words) and replaced generic exceptions with more specific ones (TypeError and ValueError).
    • Deprecated handling of preprocessor_args and secondary_preprocessor_args removed for cleaner code.
  • Improved Documentation:

    • Added detailed docstrings for the BaseMetric class and its methods, including attributes and parameter descriptions.

Updates to run_query Methods:

  • Parameter Refactoring:
    • Refactored run_query methods 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_input calls, improving readability and consistency.

Unit Test Improvements:

  • Enhanced Test Coverage:
    • Added docstrings to unit tests in tests/metrics/test_base_metric.py for clarity and documentation purposes.
    • Updated test cases to reflect refactored _check_input method and parameter changes.

These changes collectively improve code maintainability, enhance developer experience, and ensure stricter validation of inputs across the library.

@pbadillatorrealba pbadillatorrealba self-assigned this Jul 22, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 BaseMetric class and methods
  • Standardized _check_input method 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

@pbadillatorrealba pbadillatorrealba merged commit 6b65604 into develop Jul 22, 2025
4 checks passed
@pbadillatorrealba pbadillatorrealba deleted the feature/improve_base_metric branch July 22, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants