Skip to main content

Enable the use of whylogs profiles to be used in flyte tasks to get aggregate statistics about data.

Project description

Flytekit whylogs Plugin

whylogs is an open source library for logging any kind of data. With whylogs, you are able to generate summaries of datasets (called whylogs profiles) which can be used to:

  • Create data constraints to know whether your data looks the way it should
  • Quickly visualize key summary statistics about a dataset
  • Track changes in a dataset over time
pip install flytekitplugins-whylogs

To generate profiles, you can add a task like the following:

import whylogs as why
from whylogs.core import DatasetProfileView

import pandas as pd

from flytekit import task

@task
def profile(df: pd.DataFrame) -> DatasetProfileView:
    result = why.log(df) # Various overloads for different common data types exist
    profile_view = result.view()
    return profile

NOTE: You'll be passing around DatasetProfileView from tasks, not DatasetProfile.

Validating Data

A common step in data pipelines is data validation. This can be done in whylogs through the constraint feature. You'll be able to create failure tasks if the data in the workflow doesn't conform to some configured constraints, like min/max values on features, data types on features, etc.

from whylogs.core.constraints.factories import greater_than_number, mean_between_range

@task
def validate_data(profile_view: DatasetProfileView):
    builder = ConstraintsBuilder(dataset_profile_view=profile_view)
    builder.add_constraint(greater_than_number(column_name="my_column", number=0.14))
    builder.add_constraint(mean_between_range(column_name="my_other_column", lower=2, upper=3))
    constraint = builder.build()
    valid = constraint.validate()

    if valid is False:
        print(constraint.report())
        raise Exception("Invalid data found")

If you want to learn more about whylogs, check out our example notebooks.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flytekitplugins_whylogs-1.13.12.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file flytekitplugins_whylogs-1.13.12.tar.gz.

File metadata

File hashes

Hashes for flytekitplugins_whylogs-1.13.12.tar.gz
Algorithm Hash digest
SHA256 9bcc7f6eff3ec24ac70307def3047bfc1267758462bd49e9df74ff2a75563c2d
MD5 84cc5a12e273962dce73d0716a691e1b
BLAKE2b-256 b012c6410d6f564faad712c517ce17f10add7223dc927ba2c97fd312e089186c

See more details on using hashes here.

File details

Details for the file flytekitplugins_whylogs-1.13.12-py3-none-any.whl.

File metadata

File hashes

Hashes for flytekitplugins_whylogs-1.13.12-py3-none-any.whl
Algorithm Hash digest
SHA256 da3b4c671da5652e00241a91afabc252bdffc32a45db8a2522e25e745caa4b68
MD5 6d6895b1ae4539d9f11f540195002c2c
BLAKE2b-256 cf6669c24db73e715fc8e981e9f4cf9da5d7610f0c12ce09fcf5e8616912a7ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page