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
- Dimension Enumeration -- Exhaustive search over parameter subsets
- Pareto Frontier -- Identify accuracy-complexity tradeoffs
- Sensitivity Profiling -- Ablation-based importance ranking
- Model Robustness Index (MRI) -- Quantify stability under perturbation
- Adversarial Threshold Search -- Find parameter tipping points
- Compositional Testing -- Greedy dimension-building sequences
Examples
examples/geometric_economics/-- 9D behavioral economics model with 16 prediction targetsexamples/defect_prediction/-- Software defect prediction with sklearn RandomForest
Testing
pytest -v
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
809f54661ee371057e006c48f93c9aa0d3b9072d95c0cd55e3973ce34f325c79
|
|
| MD5 |
fff13751dacd2515f774b0ff52fb8e4c
|
|
| BLAKE2b-256 |
04fe53bd2753ceb51ac293fe7f868b343346e8741dd80217119d9e9437aa0c5f
|
File details
Details for the file structural_fuzzing-0.1.0-py3-none-any.whl.
File metadata
- Download URL: structural_fuzzing-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f21f4f376945d1b1732471321f0a8b5f3f981ea6599fce9cde90e18c23d9600a
|
|
| MD5 |
1c44e74371a932bccc2b92adcf749f85
|
|
| BLAKE2b-256 |
d2cd7db58e20d26aaaea0ae02f455cb542b5d7e971aec3260ca5aaefdfe6a7b6
|