Skip to content

feature: Update BaseMetric class #63

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

Merged
merged 1 commit into from
Jul 22, 2025

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 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.

1 participant