whylogs.core.metrics.multimetric#

Module Contents#

Classes#

SubmetricSchema

Helper class that provides a standard way to create an ABC using

MultiMetric

MultiMetric serves as a base class for custom metrics that consist

Attributes#

whylogs.core.metrics.multimetric.logger#
class whylogs.core.metrics.multimetric.SubmetricSchema#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract resolve(name: str, why_type: whylogs.core.datatypes.DataType, fi_disabled: bool = False) Dict[str, whylogs.core.metrics.Metric]#
Parameters
Return type

Dict[str, whylogs.core.metrics.Metric]

whylogs.core.metrics.multimetric.MULTI_METRIC#
class whylogs.core.metrics.multimetric.MultiMetric(submetrics: Dict[str, Dict[str, whylogs.core.metrics.Metric]])#

Bases: whylogs.core.metrics.Metric, abc.ABC

MultiMetric 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 several 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 MultiMetric 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 MultiMetrtic’s. You can use the submetrics_from_protbuf() and merge_submetrics() helper methods to implement them. The MultiMetric 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, Dict[str, whylogs.core.metrics.Metric]]) –

submetrics: Dict[str, Dict[str, whylogs.core.metrics.Metric]]#
merge_submetrics(other: MULTI_METRIC) Dict[str, Dict[str, whylogs.core.metrics.Metric]]#
Parameters

other (MULTI_METRIC) –

Return type

Dict[str, Dict[str, whylogs.core.metrics.Metric]]

merge(other: MULTI_METRIC) MULTI_METRIC#
Parameters

other (MULTI_METRIC) –

Return type

MULTI_METRIC

to_protobuf() whylogs.core.proto.MetricMessage#
Return type

whylogs.core.proto.MetricMessage

get_component_paths() List[str]#
Return type

List[str]

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

view (whylogs.core.preprocessing.PreprocessedColumn) –

Return type

whylogs.core.metrics.metrics.OperationResult

classmethod submetrics_from_protobuf(msg: whylogs.core.proto.MetricMessage) Dict[str, Dict[str, whylogs.core.metrics.Metric]]#
Parameters

msg (whylogs.core.proto.MetricMessage) –

Return type

Dict[str, Dict[str, whylogs.core.metrics.Metric]]

classmethod from_protobuf(msg: whylogs.core.proto.MetricMessage) MULTI_METRIC#
Parameters

msg (whylogs.core.proto.MetricMessage) –

Return type

MULTI_METRIC