-
Notifications
You must be signed in to change notification settings - Fork 514
[OPIK-668]: BaseMetric safer defaults #1826
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ class BaseMetric(abc.ABC): | |
from this class and implement the abstract methods. | ||
|
||
Args: | ||
name: The name of the metric. | ||
name: The name of the metric. If not provided, uses the class name. | ||
track: Whether to track the metric. Defaults to True. | ||
|
||
Example: | ||
|
@@ -33,8 +33,8 @@ class BaseMetric(abc.ABC): | |
>>> ) | ||
""" | ||
|
||
def __init__(self, name: str, track: bool = True) -> None: | ||
self.name = name | ||
def __init__(self, name: str | None = None, track: bool = True) -> None: | ||
self.name = name if name is not None else self.__class__.__name__ | ||
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the following would be enough:
Or even better:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ldaugusto @andrescrz I suggest closing the PR |
||
self.track = track | ||
|
||
config = opik_config.OpikConfig() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test coverage?