whylogs.core.metrics.compound_metric
#
Module Contents#
Classes#
CompoundMetric serves as a base class for custom metrics that consist |
Attributes#
- whylogs.core.metrics.compound_metric.COMPOUND_METRIC#
- class whylogs.core.metrics.compound_metric.CompoundMetric(submetrics: Dict[str, whylogs.core.metrics.Metric])#
Bases:
whylogs.core.metrics.Metric
,abc.ABC
CompoundMetric serves as a base class for custom metrics that consist of one or more metrics. It is handy when you need to do some processing of the logged values and track serveral metrics on the results. The sub-metrics must either be a StandardMetric, or tagged as a @custom_metric or registered via register_metric(). Note that CompoundMetric is neither, so it cannot be nested.
Typically you will need to override namespace(); columnar_update(), calling it on the submetrics as needed; and the zero() method to return an appropriate “empty” instance of your metric. You will need to override from_protobuf() and merge() if your subclass __init__() method takes arguments different than CompoundMetrtic’s. You can use the submetrics_from_protbuf() and merge_submetrics() helper methods to implement them. The CompoundMetric class will handle the rest of the Metric interface. Don’t use / or : in the subclass’ namespace.
See UnicodeRangeMetric for an example.
- Parameters
submetrics (Dict[str, whylogs.core.metrics.Metric]) –
- submetrics: Dict[str, whylogs.core.metrics.Metric]#
- merge_submetrics(other: COMPOUND_METRIC) Dict[str, whylogs.core.metrics.Metric] #
- Parameters
other (COMPOUND_METRIC) –
- Return type
Dict[str, whylogs.core.metrics.Metric]
- merge(other: COMPOUND_METRIC) COMPOUND_METRIC #
- Parameters
other (COMPOUND_METRIC) –
- Return type
COMPOUND_METRIC
- to_protobuf() whylogs.core.proto.MetricMessage #
- Return type
whylogs.core.proto.MetricMessage
- to_summary_dict(cfg: Optional[whylogs.core.configs.SummaryConfig] = None) Dict[str, Any] #
- Parameters
cfg (Optional[whylogs.core.configs.SummaryConfig]) –
- Return type
Dict[str, Any]
- columnar_update(view: whylogs.core.preprocessing.PreprocessedColumn) whylogs.core.metrics.metrics.OperationResult #
- Parameters
- Return type
- classmethod submetrics_from_protobuf(msg: whylogs.core.proto.MetricMessage) Dict[str, whylogs.core.metrics.Metric] #
- Parameters
msg (whylogs.core.proto.MetricMessage) –
- Return type
Dict[str, whylogs.core.metrics.Metric]
- classmethod from_protobuf(msg: whylogs.core.proto.MetricMessage) COMPOUND_METRIC #
- Parameters
msg (whylogs.core.proto.MetricMessage) –
- Return type
COMPOUND_METRIC