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, notDatasetProfile
.
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
Built Distribution
File details
Details for the file flytekitplugins_whylogs-1.14.0b3.tar.gz
.
File metadata
- Download URL: flytekitplugins_whylogs-1.14.0b3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61db969f4d80762985187137f839b35407f1ec186c3e0376d87301c4e789eb8e |
|
MD5 | a144b3466f9a2021deb3b387687803f2 |
|
BLAKE2b-256 | e14de7d7866b27a0b177993301477975a4a83c16796f3ee97514057fbcbabe98 |
File details
Details for the file flytekitplugins_whylogs-1.14.0b3-py3-none-any.whl
.
File metadata
- Download URL: flytekitplugins_whylogs-1.14.0b3-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c57bcc230d5873e1341f1e8e4d5374958ee3f4e5d4bd8132b3a75a24727d0c06 |
|
MD5 | b128bc8f9bba012380fedb141b82ce38 |
|
BLAKE2b-256 | b3248d7f9d174fa5aff6b01d2acff9a12539b1a7d6b52602532fa14eba7b891e |