whylogs.core.summaryconverters

Library module defining function for generating summaries

Module Contents

Functions

from_sketch(sketch: datasketches.update_theta_sketch, num_std_devs: float = 1)

Generate a protobuf summary message from a datasketches theta sketch

from_string_sketch(sketch: datasketches.frequent_strings_sketch)

Generate a protobuf summary message from a string sketch

quantiles_from_sketch(sketch: datasketches.kll_floats_sketch, quantiles=None)

Calculate quantiles from a data sketch

histogram_from_sketch(sketch: datasketches.kll_floats_sketch, max_buckets: int = None, avg_per_bucket: int = None)

Generate a summary of a kll_floats_sketch, including a histogram

Attributes

MAX_HIST_BUCKETS

HIST_AVG_NUMBER_PER_BUCKET

QUANTILES

whylogs.core.summaryconverters.MAX_HIST_BUCKETS = 30
whylogs.core.summaryconverters.HIST_AVG_NUMBER_PER_BUCKET = 4.0
whylogs.core.summaryconverters.QUANTILES = [0.0, 0.01, 0.05, 0.25, 0.5, 0.75, 0.95, 0.99, 1.0]
whylogs.core.summaryconverters.from_sketch(sketch: datasketches.update_theta_sketch, num_std_devs: float = 1)

Generate a protobuf summary message from a datasketches theta sketch

Parameters
  • sketch – Theta sketch to summarize

  • num_std_devs – Number of standard deviations for calculating bounds

Returns

summary

Return type

UniqueCountSummary

whylogs.core.summaryconverters.from_string_sketch(sketch: datasketches.frequent_strings_sketch)

Generate a protobuf summary message from a string sketch

Parameters

sketch – Frequent strings sketch

Returns

summary

Return type

FrequentStringsSummary

whylogs.core.summaryconverters.quantiles_from_sketch(sketch: datasketches.kll_floats_sketch, quantiles=None)

Calculate quantiles from a data sketch

Parameters
  • sketch (kll_floats_sketch) – Data sketch

  • quantiles (list-like) – Override the default quantiles. Should be a list of values from 0 to 1 inclusive.

whylogs.core.summaryconverters.histogram_from_sketch(sketch: datasketches.kll_floats_sketch, max_buckets: int = None, avg_per_bucket: int = None)

Generate a summary of a kll_floats_sketch, including a histogram

Parameters
  • sketch (kll_floats_sketch) – Data sketch

  • max_buckets (int) – Override the default maximum number of buckets

  • avg_per_bucket (int) – Override the default target number of items per bucket.

Returns

histogram – Protobuf histogram message

Return type

HistogramSummary