Skip to main content

Estimate failure probability for binary-valued black-box system

Project description

Bayesian Safety Validation

A Python implementation of bayesian safety validation.

Usage

from bayesian_safety_validation import BayesianSafetyValidation

# Define a black box function
def black_box_func(params) -> float:
    return float(
        (
            (params["x1"] + 2 * params["x2"] - 7) ** 2
            + (2 * params["x1"] + params["x2"] - 5) ** 2
        )
        <= 200
    )

# Create BSV with a parameter space
bsv = BayesianSafetyValidation(param_space={"x1": (-10, 5), "x2": (-10, 5)})

# Run BSV loop.
for i in range(10):
    suggestions = bsv.suggest()
    evaluations = [black_box_func(suggestion) for suggestion in suggestions]
    print(f"suggestions: {suggestions}, evaluations: {evaluations}")
    bsv.refit(suggestions, evaluations)

# Display results
bsv.falsification()

You will get this graph after running forementioned code

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

bayesian_safety_validation-0.0.1.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file bayesian_safety_validation-0.0.1.tar.gz.

File metadata

File hashes

Hashes for bayesian_safety_validation-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2e6abb1bcb670afbeef09b76075a4e0a9baa00f8103c3e7d5c7fb96c5c1d7786
MD5 68b562ad2e071a38981e4ee311da9077
BLAKE2b-256 74b9a9e7d847a23d33fa7f5e44a459dc20f8cc08afdcc495b412fe31920420cc

See more details on using hashes here.

Supported by

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