whylogs.core.validators#

Submodules#

Package Contents#

Classes#

ConditionValidator

A validator that checks if a column satisfies a condition.

Validator

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

Functions#

emit_usage(→ None)

whylogs.core.validators.emit_usage(event: str) None#
Parameters

event (str) –

Return type

None

class whylogs.core.validators.ConditionValidator#

Bases: whylogs.core.validators.validator.Validator

A validator that checks if a column satisfies a condition.

Parameters
  • name (str) – The name of the ConditionValidator.

  • conditions (Dict[str, Union[Condition, Callable[[Any], bool]]]) – A dictionary of conditions to check.

  • actions (List[Union[Callable[[str, str, Any], None], Callable[[str, str, Any, Optional[Any]], None]]]) – A list of actions to take when a condition fails. The action arguments represent, respectively: condition validator name, condition name, invalid value, row identity value (if any).

  • enable_sampling (bool) – Whether to enable sampling of failed values. Defaults to True.

total: int = 0#
failures: Dict[str, int]#
enable_sampling: bool = True#
sample_size: int = 10#
name: str#
conditions: Dict[str, Union[whylogs.core.metrics.condition_count_metric.Condition, Callable[[Any], bool]]]#
actions: List[Union[Callable[[str, str, Any], None], Callable[[str, str, Any, Optional[Any]], None]]]#
columnar_validate(data: Any, identity_values: Optional[Any] = None) None#
Parameters
  • data (Any) –

  • identity_values (Optional[Any]) –

Return type

None

get_samples() List[Any]#

Returns a list of samples of failed values. The number of samples is determined by the validator’s sampling size, defined through the MetricConfig. If identity_column is set, the samples will be the identity values of the failed values. Otherwise, the samples will contain the failed values themselves.

Return type

List[Any]

to_summary_dict() Dict[str, Any]#
Return type

Dict[str, Any]

class whylogs.core.validators.Validator#

Bases: abc.ABC

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

name: str#
conditions: Dict[str, Union[whylogs.core.metrics.condition_count_metric.Condition, Callable[[Any], bool]]]#
actions: List[Union[Callable[[str, str, Any], None], Callable[[str, str, Any, Optional[Any]], None]]]#
abstract columnar_validate(data: Any, identity_values: Optional[Any] = None) None#
Parameters
  • data (Any) –

  • identity_values (Optional[Any]) –

Return type

None

abstract to_summary_dict() Dict[str, Any]#
Return type

Dict[str, Any]