whylogs.core.metrics.metrics
#
Module Contents#
Classes#
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
You can use this as a base class for custom metrics that don't use |
|
Functions#
|
|
|
Attributes#
- whylogs.core.metrics.metrics.T#
- whylogs.core.metrics.metrics.M#
- whylogs.core.metrics.metrics.NUM#
- whylogs.core.metrics.metrics.METRIC#
- class whylogs.core.metrics.metrics.MetricConfig#
- whylogs.core.metrics.metrics.custom_metric(metric: Type[METRIC]) Type[METRIC] #
- Parameters
metric (Type[METRIC]) –
- Return type
Type[METRIC]
- class whylogs.core.metrics.metrics.OperationResult#
-
- classmethod ok(cnt: int = 1) OperationResult #
- Parameters
cnt (int) –
- Return type
- classmethod failed(cnt: int = 1) OperationResult #
- Parameters
cnt (int) –
- Return type
- class whylogs.core.metrics.metrics.Metric#
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- classmethod get_namespace(config: Optional[MetricConfig] = None) str #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- to_protobuf() whylogs.core.proto.MetricMessage #
- Return type
whylogs.core.proto.MetricMessage
- abstract 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]
- abstract columnar_update(data: whylogs.core.preprocessing.PreprocessedColumn) OperationResult #
- Parameters
- Return type
- abstract classmethod zero(config: Optional[MetricConfig] = None) METRIC #
- Parameters
config (Optional[MetricConfig]) –
- Return type
METRIC
- whylogs.core.metrics.metrics.register_metric(metrics: Union[Metric, Type[METRIC], List[Metric], List[Type[METRIC]]]) None #
- class whylogs.core.metrics.metrics.IntsMetric#
Bases:
Metric
Helper class that provides a standard way to create an ABC using inheritance.
- columnar_update(data: whylogs.core.preprocessing.PreprocessedColumn) OperationResult #
- Parameters
- Return type
- classmethod zero(config: Optional[MetricConfig] = None) IntsMetric #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- to_summary_dict(cfg: Optional[whylogs.core.configs.SummaryConfig] = None) Dict[str, Union[int, float, str, None]] #
- classmethod get_namespace(config: Optional[MetricConfig] = None) str #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- to_protobuf() whylogs.core.proto.MetricMessage #
- Return type
whylogs.core.proto.MetricMessage
- class whylogs.core.metrics.metrics.DistributionMetric#
Bases:
Metric
Helper class that provides a standard way to create an ABC using inheritance.
- property variance: float#
Returns the sample variance of the stream.
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford’s_online_algorithm
- Return type
- to_summary_dict(cfg: Optional[whylogs.core.configs.SummaryConfig] = None) Dict[str, Union[int, float, str, None]] #
- columnar_update(view: whylogs.core.preprocessing.PreprocessedColumn) OperationResult #
Update the operation
Algorithm: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
- Parameters
view (whylogs.core.preprocessing.PreprocessedColumn) – the preprocessed column
- Returns
how many successful operations we had
- Return type
- merge(other: DistributionMetric) DistributionMetric #
- Parameters
other (DistributionMetric) –
- Return type
- classmethod zero(config: Optional[MetricConfig] = None) DistributionMetric #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- classmethod get_namespace(config: Optional[MetricConfig] = None) str #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- to_protobuf() whylogs.core.proto.MetricMessage #
- Return type
whylogs.core.proto.MetricMessage
- class whylogs.core.metrics.metrics.FrequentItemsMetric#
Bases:
Metric
Helper class that provides a standard way to create an ABC using inheritance.
- property strings: List[FrequentItem]#
- Return type
List[FrequentItem]
- frequent_strings: whylogs.core.metrics.metric_components.FrequentStringsComponent#
- columnar_update(view: whylogs.core.preprocessing.PreprocessedColumn) OperationResult #
- Parameters
- Return type
- 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]
- classmethod zero(config: Optional[MetricConfig] = None) FrequentItemsMetric #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- classmethod get_namespace(config: Optional[MetricConfig] = None) str #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- to_protobuf() whylogs.core.proto.MetricMessage #
- Return type
whylogs.core.proto.MetricMessage
- class whylogs.core.metrics.metrics.CardinalityMetric#
Bases:
Metric
Helper class that provides a standard way to create an ABC using inheritance.
- columnar_update(view: whylogs.core.preprocessing.PreprocessedColumn) OperationResult #
- Parameters
- Return type
- 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]
- classmethod zero(config: Optional[MetricConfig] = None) CardinalityMetric #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- classmethod get_namespace(config: Optional[MetricConfig] = None) str #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- to_protobuf() whylogs.core.proto.MetricMessage #
- Return type
whylogs.core.proto.MetricMessage
- class whylogs.core.metrics.metrics.CustomMetricBase#
-
You can use this as a base class for custom metrics that don’t use the supplied or custom MetricComponents. Subclasses must be decorated with @dataclass. All fields not prefixed with an underscore will be included in the summary and will be [de]serialized. Such subclasses will need to implement the namespace, merge, and zero methods. They should be registered by calling register_metric()
- 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]
- to_protobuf() whylogs.core.proto.MetricMessage #
- Return type
whylogs.core.proto.MetricMessage
- classmethod from_protobuf(msg: whylogs.core.proto.MetricMessage) METRIC #
- Parameters
msg (whylogs.core.proto.MetricMessage) –
- Return type
METRIC
- classmethod get_namespace(config: Optional[MetricConfig] = None) str #
- Parameters
config (Optional[MetricConfig]) –
- Return type
- abstract columnar_update(data: whylogs.core.preprocessing.PreprocessedColumn) OperationResult #
- Parameters
- Return type
- abstract classmethod zero(config: Optional[MetricConfig] = None) METRIC #
- Parameters
config (Optional[MetricConfig]) –
- Return type
METRIC