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

Result class has param marked as Optional that is required #3603

Open
MattGPT-ai opened this issue Jan 27, 2025 · 0 comments
Open

Result class has param marked as Optional that is required #3603

MattGPT-ai opened this issue Jan 27, 2025 · 0 comments

Comments

@MattGPT-ai
Copy link
Contributor

The param scores has a type hint of Optional and a default value of None, but is not allowed to be unset. Perhaps this should not be an optional param. However, changing the order of params could break existing code, and keeping its position requires a default value. Otherwise, classification report must not have a default value which could break existing code as well. This is a low priority issue so it can be closed if there's no good solution here

class Result:
    def __init__(
        self,
        main_score: float,
        detailed_results: str,
        classification_report: Optional[dict] = None,
        scores: Optional[dict] = None,
    ) -> None:
        classification_report = classification_report if classification_report is not None else {}
        assert scores is not None and "loss" in scores, "No loss provided."
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

No branches or pull requests

1 participant