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.2.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flytekitplugins_whylogs-1.2.7-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file flytekitplugins-whylogs-1.2.7.tar.gz.

File metadata

  • Download URL: flytekitplugins-whylogs-1.2.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for flytekitplugins-whylogs-1.2.7.tar.gz
Algorithm Hash digest
SHA256 9c3d7a7a04c9e5b7c51087223106818fc6db5aa9da6a7ff4f75414985d083d5a
MD5 7507296ff73a1b4a5d566b43898a9058
BLAKE2b-256 62185f5d4722c786ca955a8d4f7a04de9a2b50b1b6735425eb1465173d1d8d79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flytekitplugins_whylogs-1.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 01eb525dd4a4b4a48d9ad3e1be1f2a1411967a4f060cabb90c0f4031911a6271
MD5 4db6ea334df4b7308c55b21074c7e81d
BLAKE2b-256 f091d231c9da8f75e8c0e1b0df651cef82a93650c873437155a13c3144f93b2c

See more details on using hashes here.

Supported by

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