Skip to main content

adversarial-validation

PyPI PyPI - Python Version codecov Code style: black GitHub Workflow Status Documentation Status PyPI - Wheel

A tiny framework to perform adversarial validation of your training and test data.

What is adversarial validation? A common workflow in machine learning projects (especially in Kaggle competitions) is:

  1. train your ML model in a training dataset.
  2. tune and validate your ML model in a validation dataset (typically is a discrete fraction of the training dataset).
  3. finally, assess the actual generalization ability of your ML model in a “held-out” test dataset.

This strategy is widely accepted, but it heavily relies on the assumption that the training and test datasets are drawn from the same underlying distribution. This is often referred to as the “identically distributed” property in the literature.

This package helps you easily assert whether the "identically distributed" property holds true for your training and test datasets or equivalently whether your validation dataset is a good proxy for your model's performance on the unseen test instances.

If you are a person of details, feel free to take a deep dive to the following companion article:

adversarial validation: can i trust my validation dataset?

Install

The recommended installation is via pip:

pip install advertion

(advertion stands for adversarial validation)

Usage

from advertion import validate

train = pd.read_csv("...")
test = pd.read_csv("...")

validate(
    trainset=train,
    testset=test,
    target="label",
)

# // {
# //     "datasets_follow_same_distribution": True,
# //     'mean_roc_auc': 0.5021320833333334,
# //     "adversarial_features': ['id'],
# // }

How to contribute

If you wish to contribute, this is a great place to start!

License

Distributed under the Apache License 2.0.

Metadata

Release files for advertion 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for advertion 1.0.1
File Size Uploaded Provenance
advertion-1.0.1.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for advertion 1.0.1
File Interpreter ABI Platform
advertion-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / advertion-1.0.1.tar.gz

Download URL advertion-1.0.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d9cd3b7d0f806cba4584e45423210b98461b743d9b0d054e80a8d99f2adafd3d
BLAKE2b-256 checksum
How to use checksums
1f4eb446ce5a6752c7f1446c52c77ccd4d898ec662a9962c2cfb412e85e82628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.15 Linux/6.8.0-1017-azure

Release files / advertion-1.0.1-py3-none-any.whl

Download URL advertion-1.0.1-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
464721066c3ce9d95b2597282b93449399f62951f8daec81da79704943ba67ee
BLAKE2b-256 checksum
How to use checksums
806eb1c784ad3b50cf80b299c1d6d2f6187183e58e96a62593907ee8b0701981
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.15 Linux/6.8.0-1017-azure

Security for advertion 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page