whylogs.core.constraints.factories.distribution_metrics#

Module Contents#

Functions#

greater_than_number(...)

Minimum value of given column must be above defined number.

smaller_than_number(...)

Maximum value of given column must be below defined number.

is_non_negative(...)

Checks if a column is non negative

is_in_range(→ whylogs.core.constraints.MetricConstraint)

Checks that all of column's values are in defined range (inclusive).

mean_between_range(...)

Estimated mean must be between range defined by lower and upper bounds.

stddev_between_range(column_name, lower, upper[, ...])

Estimated standard deviation must be between range defined by lower and upper bounds.

quantile_between_range(...)

Q-th quantile value must be withing the range defined by lower and upper boundaries.

whylogs.core.constraints.factories.distribution_metrics.greater_than_number(column_name: str, number: Union[float, int], skip_missing: bool = True) whylogs.core.constraints.MetricConstraint#

Minimum value of given column must be above defined number.

Parameters
  • column_name (str) – Column the constraint is applied to

  • number (float) – reference value for applying the constraint

  • skip_missing (bool) – If skip_missing is True, missing distribution metrics will make the check pass. If False, the check will fail on missing metrics, such as on an empty dataset

Return type

whylogs.core.constraints.MetricConstraint

whylogs.core.constraints.factories.distribution_metrics.smaller_than_number(column_name: str, number: float, skip_missing: bool = True) whylogs.core.constraints.MetricConstraint#

Maximum value of given column must be below defined number.

Parameters
  • column_name (str) – Column the constraint is applied to

  • number (float) – reference value for applying the constraint

  • skip_missing (bool) – If skip_missing is True, missing distribution metrics will make the check pass. If False, the check will fail on missing metrics, such as on an empty dataset

Return type

whylogs.core.constraints.MetricConstraint

whylogs.core.constraints.factories.distribution_metrics.is_non_negative(column_name: str, skip_missing: bool = True) whylogs.core.constraints.MetricConstraint#

Checks if a column is non negative

Parameters
  • column_name (str) – Column the constraint is applied to

  • skip_missing (bool) – If skip_missing is True, missing distribution metrics will make the check pass. If False, the check will fail on missing metrics, such as on an empty dataset

Return type

whylogs.core.constraints.MetricConstraint

whylogs.core.constraints.factories.distribution_metrics.is_in_range(column_name: str, lower: Union[float, int], upper: Union[float, int], skip_missing: bool = True) whylogs.core.constraints.MetricConstraint#

Checks that all of column’s values are in defined range (inclusive).

For the constraint to pass, the column’s minimum value should be higher or equal than lower and maximum value should be less than or equal to upper.

Parameters
  • column_name (str) – Column the constraint is applied to

  • lower (float) – lower bound of defined range

  • upper (float) – upper bound of defined range

  • skip_missing (bool) – If skip_missing is True, missing distribution metrics will make the check pass. If False, the check will fail on missing metrics, such as on an empty dataset

Return type

whylogs.core.constraints.MetricConstraint

whylogs.core.constraints.factories.distribution_metrics.mean_between_range(column_name: str, lower: float, upper: float, skip_missing: bool = True) whylogs.core.constraints.MetricConstraint#

Estimated mean must be between range defined by lower and upper bounds.

Parameters
  • column_name (str) – Column the constraint is applied to

  • lower (int) – Lower bound of defined range

  • upper (int) – Upper bound of the value range

  • skip_missing (bool) – If skip_missing is True, missing distribution metrics will make the check pass. If False, the check will fail on missing metrics, such as on an empty dataset

Return type

whylogs.core.constraints.MetricConstraint

whylogs.core.constraints.factories.distribution_metrics.stddev_between_range(column_name: str, lower: float, upper: float, skip_missing: bool = True)#

Estimated standard deviation must be between range defined by lower and upper bounds.

Parameters
  • column_name (str) – Column the constraint is applied to

  • lower (float) – Lower bound of defined range

  • upper (float) – Upper bound of the value range

  • skip_missing (bool) – If skip_missing is True, missing distribution metrics will make the check pass. If False, the check will fail on missing metrics, such as on an empty dataset

whylogs.core.constraints.factories.distribution_metrics.quantile_between_range(column_name: str, quantile: float, lower: float, upper: float, skip_missing: bool = True) whylogs.core.constraints.MetricConstraint#

Q-th quantile value must be withing the range defined by lower and upper boundaries.

Parameters
  • column_name (str) – Column the constraint is applied to

  • quantile (float) – Quantile value. E.g. median is equal to quantile_value=0.5

  • lower (float) – Lower bound of defined range

  • upper (float) – Upper bound of the value range

  • skip_missing (bool) – If skip_missing is True, missing distribution metrics will make the check pass. If False, the check will fail on missing metrics, such as on an empty dataset

Return type

whylogs.core.constraints.MetricConstraint