whylogs.core.statistics.constraints

Module Contents

Classes

ValueConstraint

ValueConstraints express a binary boolean relationship between an implied numeric value and a literal.

SummaryConstraint

Summary constraints specify a relationship between a summary field and a static value,

ValueConstraints

SummaryConstraints

DatasetConstraints

Attributes

logger

Dict indexed by constraint operator.

_value_funcs

_summary_funcs1

_summary_funcs2

whylogs.core.statistics.constraints.logger

Dict indexed by constraint operator.

These help translate from constraint schema to language-specific functions that are faster to evaluate. This is just a form of currying, and I chose to bind the boolean comparison operator first.

whylogs.core.statistics.constraints._value_funcs
whylogs.core.statistics.constraints._summary_funcs1
whylogs.core.statistics.constraints._summary_funcs2
class whylogs.core.statistics.constraints.ValueConstraint(op: whylogs.proto.Op, value, name: str = None, verbose=False)

ValueConstraints express a binary boolean relationship between an implied numeric value and a literal. When associated with a ColumnProfile, the relation is evaluated for every incoming value that is processed by whylogs.

Parameters
  • op (whylogs.proto.Op (required)) – Enumeration of binary comparison operator applied between static value and incoming stream. Enum values are mapped to operators like ‘==’, ‘<’, and ‘<=’, etc.

  • value ((required)) – Static value to compare against incoming stream using operator specified in op.

  • name (str) – Name of the constraint used for reporting

  • verbose (bool) – If true, log every application of this constraint that fails. Useful to identify specific streaming values that fail the constraint.

property name(self)
update(self, v)bool
static from_protobuf(msg: whylogs.proto.ValueConstraintMsg)ValueConstraint
to_protobuf(self)whylogs.proto.ValueConstraintMsg
report(self)
class whylogs.core.statistics.constraints.SummaryConstraint(first_field: str, op: whylogs.proto.Op, value=None, second_field: str = None, name: str = None, verbose=False)

Summary constraints specify a relationship between a summary field and a static value, or between two summary fields. e.g. ‘min’ < 6

‘std_dev’ < 2.17 ‘min’ > ‘avg’

Parameters
  • first_field (str) – Name of field in NumberSummary that will be compared against either a second field or a static value.

  • op (whylogs.proto.Op (required)) – Enumeration of binary comparison operator applied between summary values. Enum values are mapped to operators like ‘==’, ‘<’, and ‘<=’, etc.

  • value ((one-of)) – Static value to be compared against summary field specified in first_field. Only one of value or second_field should be supplied.

  • second_field ((one-of)) – Name of second field in NumberSummary to be compared against summary field specified in first_field. Only one of value or second_field should be supplied.

  • name (str) – Name of the constraint used for reporting

  • verbose (bool) – If true, log every application of this constraint that fails. Useful to identify specific streaming values that fail the constraint.

property name(self)
update(self, summ: whylogs.proto.NumberSummary)bool
static from_protobuf(msg: whylogs.proto.SummaryConstraintMsg)SummaryConstraint
to_protobuf(self)whylogs.proto.SummaryConstraintMsg
report(self)
class whylogs.core.statistics.constraints.ValueConstraints(constraints: List[ValueConstraint] = [])
static from_protobuf(msg: whylogs.proto.ValueConstraintMsgs)ValueConstraints
to_protobuf(self)whylogs.proto.ValueConstraintMsgs
update(self, v)
report(self)List[tuple]
class whylogs.core.statistics.constraints.SummaryConstraints(constraints: List[SummaryConstraint])
static from_protobuf(msg: whylogs.proto.SummaryConstraintMsgs)SummaryConstraints
to_protobuf(self)whylogs.proto.SummaryConstraintMsgs
update(self, v)
report(self)List[tuple]
class whylogs.core.statistics.constraints.DatasetConstraints(props: whylogs.proto.DatasetProperties, value_constraints: Optional[Mapping[str, ValueConstraints]] = None, summary_constraints: Optional[Mapping[str, SummaryConstraints]] = None)
__getitem__(self, key)
static from_protobuf(msg: whylogs.proto.DatasetConstraintMsg)DatasetConstraints
static from_json(data: str)DatasetConstraints
to_protobuf(self)whylogs.proto.DatasetConstraintMsg
to_json(self)str
report(self)