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
Support custom mergeable metrics in whylogs #241
Comments
For 1, we're already doing this. For 2, we'll need to support:
For 3, we can start with supporting numbers. But what's the behavior when merging two objects with "unmergeable" metrics? Should we throw exception? Warnings? Drop the fields? |
I would focus on a simple class custom metric api, like
if there is no merge then we cant merge, unless it inherents from something like numberTracker . |
That might work. We still need to:
|
A base class should be able to handle serialization pretty easily. @dataclass
class CustomMetric(abc.ABC):
@abc.abstractmethod
def track():
pass
@abc.abstracmethod
def merge(self, right_metric: 'CustomMetric'):
pass
@abc.abstractmethod
def name():
pass
def deserialize(name:str) -> 'CustomMetric'
//implementation here by traversing subclasses of 'CustomMetric' and calling its constructor
def serialize():
return {"name": self.name, 'params': dataclasses.asdict(self) } |
except we need at least the protobuf de/serialization |
The protobuf message packing and then serialization is how our datasetprofile serializes all the associated metrics for a dataset when the logger writes, but I took your suggestion using a dataclass and doing most of that work in a base class. Here is a draft PR if you have comments: #300 |
There are three kinds of metrics that whylogs users track:
The text was updated successfully, but these errors were encountered: