Skip to main content

Structural fuzzing framework for parameterized model validation

Project description

structural-fuzzing

Structural fuzzing framework for parameterized model validation.

Adapts the adversarial mindset of software fuzzing to model validation: instead of mutating program inputs to find crashes, we mutate model parameters to find prediction failures.

Installation

pip install -e ".[dev,examples]"

Quick Start

import numpy as np
from structural_fuzzing import run_campaign

# Define your model's evaluate function
def evaluate_fn(params):
    """params: 1D array, one value per dimension.
    Returns: (mae, {target_name: error})
    """
    # Your model logic here
    errors = {"target_1": compute_error_1(params), ...}
    mae = sum(abs(v) for v in errors.values()) / len(errors)
    return mae, errors

# Run the full campaign
report = run_campaign(
    dim_names=["dim_a", "dim_b", "dim_c"],
    evaluate_fn=evaluate_fn,
)
print(report.summary())

Components

  1. Dimension Enumeration -- Exhaustive search over parameter subsets
  2. Pareto Frontier -- Identify accuracy-complexity tradeoffs
  3. Sensitivity Profiling -- Ablation-based importance ranking
  4. Model Robustness Index (MRI) -- Quantify stability under perturbation
  5. Adversarial Threshold Search -- Find parameter tipping points
  6. Compositional Testing -- Greedy dimension-building sequences

Examples

  • examples/geometric_economics/ -- 9D behavioral economics model with 16 prediction targets
  • examples/defect_prediction/ -- Software defect prediction with sklearn RandomForest

Testing

pytest -v

License

MIT

Project details


Download files

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

Source Distribution

structural_fuzzing-0.1.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

structural_fuzzing-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file structural_fuzzing-0.1.0.tar.gz.

File metadata

  • Download URL: structural_fuzzing-0.1.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for structural_fuzzing-0.1.0.tar.gz
Algorithm Hash digest
SHA256 809f54661ee371057e006c48f93c9aa0d3b9072d95c0cd55e3973ce34f325c79
MD5 fff13751dacd2515f774b0ff52fb8e4c
BLAKE2b-256 04fe53bd2753ceb51ac293fe7f868b343346e8741dd80217119d9e9437aa0c5f

See more details on using hashes here.

File details

Details for the file structural_fuzzing-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for structural_fuzzing-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f21f4f376945d1b1732471321f0a8b5f3f981ea6599fce9cde90e18c23d9600a
MD5 1c44e74371a932bccc2b92adcf749f85
BLAKE2b-256 d2cd7db58e20d26aaaea0ae02f455cb542b5d7e971aec3260ca5aaefdfe6a7b6

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