Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Evidentlyai Evidently Column Statistics Classes

From Leeroopedia
Revision as of 12:27, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Evidentlyai_Evidently_Column_Statistics_Classes.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Data_Quality, Statistics
Last Updated 2026-02-14 12:00 GMT

Overview

Concrete metric classes for computing column-level statistics provided by the Evidently library.

Description

Individual metric classes for column statistics:

  • MeanValue(column): Computes arithmetic mean
  • CategoryCount(column, category): Counts category occurrences (count and share)
  • InRangeValueCount(column, left, right): Counts values in range (count and share)
  • MissingValueCount(column): Counts null/NaN values (count and share)

Usage

Import from evidently.metrics and include in Report metrics lists.

Code Reference

Source Location

  • Repository: evidently
  • File: src/evidently/metrics/column_statistics.py
  • Lines: L264-524 (CategoryCount, InRangeValueCount, MissingValueCount, MeanValue)

Signature

class MeanValue(StatisticsMetric):
    """Column mean. Inherits column from ColumnMetric."""
    # column: str (inherited)

class CategoryCount(ColumnMetric, CountMetric):
    category: Optional[Label] = None
    categories: List[Label] = []
    def __init__(self, column: str, categories: Optional[List[Label]] = None,
                 category: Optional[Label] = None, tests: Optional[List[MetricTest]] = None,
                 share_tests: Optional[List[MetricTest]] = None):

class InRangeValueCount(ColumnMetric, CountMetric):
    left: Union[int, float]
    right: Union[int, float]

class MissingValueCount(ColumnMetric, CountMetric):
    # column: str (inherited)

Import

from evidently.metrics import MeanValue, CategoryCount, InRangeValueCount, MissingValueCount

I/O Contract

Inputs

Metric Key Parameters Description
MeanValue column: str Column to compute mean of
CategoryCount column: str, category: Label Column and category to count
InRangeValueCount column: str, left: float, right: float Column and range bounds
MissingValueCount column: str Column to check for missing values

Outputs

Metric Returns Description
MeanValue float Arithmetic mean
CategoryCount (count: int, share: float) Category count and proportion
InRangeValueCount (count: int, share: float) In-range count and proportion
MissingValueCount (count: int, share: float) Missing count and proportion

Usage Examples

from evidently import Report
from evidently.metrics import MeanValue, CategoryCount, InRangeValueCount, MissingValueCount

report = Report([
    MeanValue(column="Sentiment"),
    CategoryCount(column="Negativity", category="negative"),
    InRangeValueCount(column="text_length", left=10, right=500),
    MissingValueCount(column="review"),
])

snapshot = report.run(current_dataset, reference_dataset)

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment